-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
e_vote-initial-setup.sql
executable file
·71 lines (57 loc) · 2.13 KB
/
e_vote-initial-setup.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
---------------------------------------------------------
CREATE TABLE `t_admin` (
`id_admin` tinyint(1) NOT NULL,
`username` varchar(35) NOT NULL,
`fullname` varchar(50) NOT NULL,
`password` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
INSERT INTO `t_admin` (`id_admin`, `username`, `fullname`, `password`) VALUES
(1, 'ReiChan', 'administrator', '$2y$10$5ok3rcIOv/yNIlPIGo49a.cXRAiA5ZsnxbpijFoyy5EuuYyVrZetu');
---------------------------------------------------------
CREATE TABLE `t_kandidat` (
`id_kandidat` smallint(4) NOT NULL,
`nama_calon` varchar(50) NOT NULL,
`foto` varchar(255) NOT NULL,
`visi` varchar(255) NOT NULL,
`misi` varchar(255) NOT NULL,
`suara` smallint(4) NOT NULL DEFAULT '0',
`periode` varchar(9) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
---------------------------------------------------------
CREATE TABLE `t_kelas` (
`id_kelas` varchar(6) NOT NULL,
`nama_kelas` varchar(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
---------------------------------------------------------
CREATE TABLE `t_pemilih` (
`nis` varchar(10) NOT NULL,
`periode` varchar(9) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
---------------------------------------------------------
CREATE TABLE `t_user` (
`id_user` varchar(10) NOT NULL,
`fullname` varchar(50) NOT NULL,
`id_kelas` varchar(3) NOT NULL,
`jk` enum('L','P') NOT NULL,
`pemilih` enum('Y','N') NOT NULL DEFAULT 'Y'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
----------------------------------------------------------
ALTER TABLE `t_admin`
ADD PRIMARY KEY (`id_admin`);
-------------------------
ALTER TABLE `t_kandidat`
ADD PRIMARY KEY (`id_kandidat`);
-------------------------
ALTER TABLE `t_kelas`
ADD PRIMARY KEY (`id_kelas`);
-------------------------
ALTER TABLE `t_user`
ADD PRIMARY KEY (`id_user`);
-------------------------
ALTER TABLE `t_admin`
MODIFY `id_admin` tinyint(1) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--------------------------
ALTER TABLE `t_kandidat`
MODIFY `id_kandidat` smallint(4) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;