33 lines
1.2 KiB
SQL
33 lines
1.2 KiB
SQL
-- ================================================================
|
|
-- Create ONE active election for demo (current date/time)
|
|
-- ================================================================
|
|
|
|
-- Insert active election (now + 24 hours)
|
|
INSERT INTO elections (name, description, start_date, end_date, elgamal_p, elgamal_g, is_active, results_published)
|
|
VALUES (
|
|
'Election Présidentielle 2025 - Demo',
|
|
'Démonstration du système de vote en ligne avec blockchain',
|
|
NOW(),
|
|
DATE_ADD(NOW(), INTERVAL 24 HOUR),
|
|
23,
|
|
5,
|
|
TRUE,
|
|
FALSE
|
|
);
|
|
|
|
-- Get the election ID (should be 11 if 10 past elections exist)
|
|
SET @election_id = LAST_INSERT_ID();
|
|
|
|
-- Insert 3 candidates for the demo election
|
|
INSERT INTO candidates (election_id, name, description, `order`)
|
|
VALUES
|
|
(@election_id, 'Alice Dupont', 'Candidate A - Progressive', 1),
|
|
(@election_id, 'Bob Martin', 'Candidate B - Centrist', 2),
|
|
(@election_id, 'Claire Laurent', 'Candidate C - Conservative', 3);
|
|
|
|
-- Confirmation
|
|
SELECT CONCAT('✓ Active election created: ID=', @election_id) as status;
|
|
SELECT COUNT(*) as total_elections FROM elections;
|
|
SELECT * FROM elections WHERE id = @election_id;
|
|
SELECT * FROM candidates WHERE election_id = @election_id;
|