-
Notifications
You must be signed in to change notification settings - Fork 0
/
forms.sql
196 lines (162 loc) · 4.75 KB
/
forms.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
-- phpMyAdmin SQL Dump
-- version 4.4.1
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Apr 10, 2015 at 05:29 PM
-- Server version: 5.5.41-0ubuntu0.12.04.1-log
-- PHP Version: 5.3.10-1ubuntu3.17
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- Database: `forms`
--
-- --------------------------------------------------------
--
-- Table structure for table `contacts`
--
CREATE TABLE IF NOT EXISTS `contacts` (
`id` int(11) NOT NULL,
`contact_name` varchar(100) NOT NULL,
`contact_email` varchar(200) NOT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`form_id` int(11) NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `fields`
--
CREATE TABLE IF NOT EXISTS `fields` (
`id` int(11) NOT NULL,
`field_name` varchar(100) NOT NULL,
`form_id` int(11) NOT NULL,
`type_id` int(11) NOT NULL,
`placeholder` varchar(150) NOT NULL,
`length` int(11) NOT NULL DEFAULT '100',
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00'
) ENGINE=InnoDB AUTO_INCREMENT=49 DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `forms`
--
CREATE TABLE IF NOT EXISTS `forms` (
`id` int(11) NOT NULL,
`form_name` varchar(100) NOT NULL,
`redirect` varchar(300) NOT NULL,
`created_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB AUTO_INCREMENT=62 DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `types`
--
CREATE TABLE IF NOT EXISTS `types` (
`id` int(11) NOT NULL,
`name` varchar(150) NOT NULL,
`sql_format` varchar(300) NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `types`
--
INSERT INTO `types` (`id`, `name`, `sql_format`) VALUES
(1, 'text', 'varchar(**length**)'),
(2, 'textarea', 'text'),
(3, 'checkbox', 'tinyint(1)'),
(4, 'email', 'varchar(250)');
-- --------------------------------------------------------
--
-- Table structure for table `users`
--
CREATE TABLE IF NOT EXISTS `users` (
`id` int(11) NOT NULL,
`username` varchar(50) NOT NULL,
`password` varchar(255) DEFAULT NULL
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `users`
--
INSERT INTO `users` (`id`, `username`, `password`) VALUES
(1, 'root', 'dc76e9f0c0006e8f919e0c515c66dbba3982f785');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `contacts`
--
ALTER TABLE `contacts`
ADD PRIMARY KEY (`id`),
ADD KEY `form_id` (`form_id`);
--
-- Indexes for table `fields`
--
ALTER TABLE `fields`
ADD PRIMARY KEY (`id`),
ADD KEY `form_id` (`form_id`),
ADD KEY `field_type` (`type_id`),
ADD KEY `field_type_id` (`type_id`);
--
-- Indexes for table `forms`
--
ALTER TABLE `forms`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `types`
--
ALTER TABLE `types`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `contacts`
--
ALTER TABLE `contacts`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=18;
--
-- AUTO_INCREMENT for table `fields`
--
ALTER TABLE `fields`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=49;
--
-- AUTO_INCREMENT for table `forms`
--
ALTER TABLE `forms`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=62;
--
-- AUTO_INCREMENT for table `types`
--
ALTER TABLE `types`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=2;
--
-- Constraints for dumped tables
--
--
-- Constraints for table `contacts`
--
ALTER TABLE `contacts`
ADD CONSTRAINT `contacts_ibfk_1` FOREIGN KEY (`form_id`) REFERENCES `forms` (`id`);
--
-- Constraints for table `fields`
--
ALTER TABLE `fields`
ADD CONSTRAINT `fields_ibfk_3` FOREIGN KEY (`form_id`) REFERENCES `forms` (`id`),
ADD CONSTRAINT `fields_ibfk_4` FOREIGN KEY (`type_id`) REFERENCES `types` (`id`);
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;