SQL query for create table
This commit is contained in:
parent
dfa0c52247
commit
b38f4b7893
50
sql/gebox.sql
Normal file
50
sql/gebox.sql
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
-- README
|
||||||
|
-- Prefix idx_ = index
|
||||||
|
-- Prefix fk_ = foreign
|
||||||
|
-- Create an index for fast lookups
|
||||||
|
-- Defining constraints separately for better readability & maintainability
|
||||||
|
-- Prefix p_ = Procedure
|
||||||
|
-- Prefix i_ = Input(s)
|
||||||
|
-- Prefix v_ = Variable(s)
|
||||||
|
-- Prefix o_ = Output(s)
|
||||||
|
|
||||||
|
-- Instance table
|
||||||
|
|
||||||
|
create table if not exists `gebox_instance` (
|
||||||
|
`id` int(11) not null auto_increment primary key,
|
||||||
|
--`profile` int(11) not null,
|
||||||
|
`instance` varchar(36) not null,
|
||||||
|
`domain` longtext not null,
|
||||||
|
`product` int(11) not null,
|
||||||
|
`status` text default 'pending',
|
||||||
|
--key `idx_profile` (`profile`),
|
||||||
|
key `idx_product` (`product`),
|
||||||
|
--constraint `gebox_instance_fk_profile`
|
||||||
|
-- foreign key (`profile`) references `auth_profile` (`id`)
|
||||||
|
-- on update cascade
|
||||||
|
-- on delete cascade,
|
||||||
|
constraint `gebox_instance_fk_product`
|
||||||
|
foreign key (`product`) references `gebox_package_version` (`id`)
|
||||||
|
on update restrict
|
||||||
|
on delete restrict
|
||||||
|
) engine=InnoDB default charset=utf8mb4;
|
||||||
|
|
||||||
|
-- Main table
|
||||||
|
|
||||||
|
create table if not exists `gebox_package` (
|
||||||
|
`id` int(11) not null auto_increment primary key,
|
||||||
|
`name` varchar(36) not null,
|
||||||
|
`desc` longtext default null
|
||||||
|
) engine=InnoDB default charset=utf8mb4;
|
||||||
|
|
||||||
|
create table if not exists `gebox_package_version` (
|
||||||
|
`id` int(11) not null auto_increment primary key,
|
||||||
|
`package` int(11) not null,
|
||||||
|
`version` longtext not null,
|
||||||
|
`release` datetime default null,
|
||||||
|
key `idx_package` (`package`),
|
||||||
|
constraint `gebox_instance_fk_package`
|
||||||
|
foreign key (`package`) references `gebox_package` (`id`)
|
||||||
|
on update cascade
|
||||||
|
on delete cascade
|
||||||
|
) engine=InnoDB default charset=utf8mb4;
|
Loading…
Reference in New Issue
Block a user