Merge sql schema files

When populating a database we'll create all tables regardless of what
is actually required for the current use case.
This commit is contained in:
Johannes Meyer 2014-10-07 15:55:43 +02:00
parent d54bfddee4
commit efffe10bad
5 changed files with 24 additions and 56 deletions

View File

@ -1,24 +0,0 @@
create table account (
`username` varchar(255) COLLATE latin1_general_ci NOT NULL,
`salt` varchar(255) NOT NULL,
`password` varchar(255) NOT NULL,
`active` tinyint(1) DEFAULT NULL,
PRIMARY KEY (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*
* user: icingaadmin
* password: icinga
*/
INSERT INTO account (
`username`,
`salt`,
`password`,
`active`
)
VALUES (
'icingaadmin',
'57cfd5746224be4f60c25d4e8514bec35ad2d01810723a138756b285898e71b2',
'43f8e0588eb39f1a41383b48def0b1fdc45e79b8f67194cccee4453eb3f4ea13',
1
);

14
etc/schema/mysql.sql Normal file
View File

@ -0,0 +1,14 @@
create table account (
`username` varchar(255) COLLATE latin1_general_ci NOT NULL,
`salt` varchar(255) NOT NULL,
`password` varchar(255) NOT NULL,
`active` tinyint(1) DEFAULT NULL,
PRIMARY KEY (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
create table `preference`(
`username` VARCHAR(255) COLLATE latin1_general_ci NOT NULL,
`key` VARCHAR(100) COLLATE latin1_general_ci NOT NULL,
`value` VARCHAR(255) NOT NULL,
PRIMARY KEY (`username`, `key`)
) ENGINE=InnoDB;

View File

@ -10,19 +10,13 @@ ALTER TABLE ONLY "account"
CREATE UNIQUE INDEX username_lower_unique_idx ON "account" USING btree (lower((username)::text));
/*
* user: icingaadmin
* password: icinga
*/
INSERT INTO "account" (
"username",
"salt",
"password",
"active"
)
VALUES (
'icingaadmin',
'57cfd5746224be4f60c25d4e8514bec35ad2d01810723a138756b285898e71b2',
'43f8e0588eb39f1a41383b48def0b1fdc45e79b8f67194cccee4453eb3f4ea13',
true
);
create table "preference"(
"username" VARCHAR(255) NOT NULL,
"key" VARCHAR(100) NOT NULL,
"value" VARCHAR(255) NOT NULL
);
ALTER TABLE ONLY "preference"
ADD CONSTRAINT preference_pkey PRIMARY KEY ("username", "key");
CREATE UNIQUE INDEX username_and_key_lower_unique_idx ON "preference" USING btree (lower((username)::text), lower((key)::text));

View File

@ -1,6 +0,0 @@
create table `preference`(
`username` VARCHAR(255) COLLATE latin1_general_ci NOT NULL,
`key` VARCHAR(100) COLLATE latin1_general_ci NOT NULL,
`value` VARCHAR(255) NOT NULL,
PRIMARY KEY (`username`, `key`)
) ENGINE=InnoDB;

View File

@ -1,10 +0,0 @@
create table "preference"(
"username" VARCHAR(255) NOT NULL,
"key" VARCHAR(100) NOT NULL,
"value" VARCHAR(255) NOT NULL
);
ALTER TABLE ONLY "preference"
ADD CONSTRAINT preference_pkey PRIMARY KEY ("username", "key");
CREATE UNIQUE INDEX username_and_key_lower_unique_idx ON "preference" USING btree (lower((username)::text), lower((key)::text));