-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.sql
More file actions
22 lines (19 loc) · 678 Bytes
/
init.sql
File metadata and controls
22 lines (19 loc) · 678 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
CREATE DATABASE boilerplate;
-- Create People table
CREATE TABLE boilerplate.people (
id BIGINT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(255) NOT NULL,
age INTEGER NOT NULL
);
-- Create Widgets table
CREATE TABLE boilerplate.widgets (
id BIGINT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(255) NOT NULL,
value VARCHAR(255),
owner_id BIGINT,
FOREIGN KEY (owner_id) REFERENCES boilerplate.people(id) ON DELETE CASCADE
);
-- Create indexes for better performance
CREATE INDEX idx_widgets_owner_id ON boilerplate.widgets(owner_id);
CREATE INDEX idx_people_name ON boilerplate.people(name);
CREATE INDEX idx_widgets_name ON boilerplate.widgets(name);