/server/zanata-war/src/main/resources/db/h2/h2_baseline.sql
https://github.com/hferentschik/zanata · SQL · 485 lines · 414 code · 66 blank · 5 comment · 0 complexity · 039c64ac9e34f8461c95026eb3946761 MD5 · raw file
- /*
- * Warning: Please do not change this file!
- * Any changes to the database schema should be added as
- * Liquibase changeSets in db.changelog.xml
- */
- create table HAccount (
- id bigint generated by default as identity,
- creationDate timestamp not null,
- lastChanged timestamp not null,
- versionNum integer not null,
- apiKey varchar(32),
- enabled bit not null,
- passwordHash varchar(255),
- username varchar(255),
- primary key (id),
- unique (username)
- );
- create table HAccountActivationKey (
- keyHash varchar(32) not null,
- accountId bigint not null,
- primary key (keyHash),
- unique (accountId)
- );
- create table HAccountMembership (
- accountId bigint not null,
- memberOf integer not null,
- primary key (accountId, memberOf)
- );
- create table HAccountResetPasswordKey (
- keyHash varchar(32) not null,
- accountId bigint not null,
- primary key (keyHash),
- unique (accountId)
- );
- create table HAccountRole (
- id integer generated by default as identity,
- conditional bit not null,
- name varchar(255),
- primary key (id)
- );
- create table HAccountRoleGroup (
- roleId integer not null,
- memberOf integer not null,
- primary key (roleId, memberOf)
- );
- create table HApplicationConfiguration (
- id bigint generated by default as identity,
- creationDate timestamp not null,
- lastChanged timestamp not null,
- versionNum integer not null,
- config_key varchar(255) not null,
- config_value clob not null,
- primary key (id),
- unique (config_key)
- );
- create table HCommunity (
- id bigint generated by default as identity,
- creationDate timestamp not null,
- lastChanged timestamp not null,
- versionNum integer not null,
- slug varchar(40) not null,
- description varchar(100),
- homeContent clob,
- name varchar(255) not null,
- ownerId bigint not null,
- primary key (id),
- unique (slug)
- );
- create table HCommunity_Member (
- personId bigint not null,
- communityId bigint not null,
- primary key (communityId, personId)
- );
- create table HCommunity_Officer (
- personId bigint not null,
- communityId bigint not null,
- primary key (communityId, personId)
- );
- create table HDocument (
- id bigint generated by default as identity,
- creationDate timestamp not null,
- lastChanged timestamp not null,
- versionNum integer not null,
- contentType varchar(255) not null,
- docId varchar(255) not null,
- name varchar(255) not null,
- obsolete bit not null,
- path varchar(255) not null,
- revision integer not null,
- last_modified_by_id bigint,
- locale bigint not null,
- poHeader_id bigint,
- project_iteration_id bigint not null,
- primary key (id),
- unique (docId, project_iteration_id)
- );
- create table HDocumentHistory (
- id bigint generated by default as identity,
- contentType varchar(255) not null,
- docId varchar(255) not null,
- lastChanged timestamp,
- name varchar(255),
- obsolete bit not null,
- path varchar(255),
- revision integer,
- document_id bigint,
- last_modified_by_id bigint,
- locale bigint not null,
- primary key (id),
- unique (document_id, revision)
- );
- create table HLocale (
- id bigint generated by default as identity,
- creationDate timestamp not null,
- lastChanged timestamp not null,
- versionNum integer not null,
- active bit not null,
- localeId varchar(255) not null,
- primary key (id),
- unique (localeId)
- );
- create table HLocale_Member (
- personId bigint not null,
- supportedLanguageId bigint not null,
- primary key (supportedLanguageId, personId)
- );
- create table HPerson (
- id bigint generated by default as identity,
- creationDate timestamp not null,
- lastChanged timestamp not null,
- versionNum integer not null,
- email varchar(255) not null,
- name varchar(80) not null,
- accountId bigint,
- primary key (id),
- unique (email)
- );
- create table HPoHeader (
- id bigint generated by default as identity,
- creationDate timestamp not null,
- lastChanged timestamp not null,
- versionNum integer not null,
- entries clob,
- comment_id bigint,
- primary key (id)
- );
- create table HPoTargetHeader (
- id bigint generated by default as identity,
- creationDate timestamp not null,
- lastChanged timestamp not null,
- versionNum integer not null,
- entries clob,
- comment_id bigint,
- document_id bigint,
- targetLanguage bigint not null,
- primary key (id),
- unique (document_id, targetLanguage)
- );
- create table HPotEntryData (
- id bigint generated by default as identity,
- context varchar(255),
- flags varchar(255),
- refs clob,
- comment_id bigint,
- tf_id bigint unique,
- primary key (id),
- unique (tf_id)
- );
- create table HProject (
- projecttype varchar(31) not null,
- id bigint generated by default as identity,
- creationDate timestamp not null,
- lastChanged timestamp not null,
- versionNum integer not null,
- slug varchar(40) not null,
- description varchar(100),
- homeContent clob,
- name varchar(80) not null,
- primary key (id),
- unique (slug)
- );
- create table HProjectIteration (
- id bigint generated by default as identity,
- creationDate timestamp not null,
- lastChanged timestamp not null,
- versionNum integer not null,
- slug varchar(40) not null,
- active bit not null,
- description varchar(255),
- name varchar(20),
- parentId bigint,
- project_id bigint not null,
- primary key (id),
- unique (slug, project_id)
- );
- create table HProject_Maintainer (
- personId bigint not null,
- projectId bigint not null,
- primary key (projectId, personId)
- );
- create table HSimpleComment (
- id bigint generated by default as identity,
- comment clob not null,
- primary key (id)
- );
- create table HTextFlow (
- id bigint generated by default as identity,
- content clob not null,
- obsolete bit not null,
- pos integer not null,
- resId varchar(255) not null,
- revision integer not null,
- comment_id bigint,
- document_id bigint not null,
- potEntryData_id bigint,
- primary key (id),
- unique (document_id, resId)
- );
- create table HTextFlowHistory (
- id bigint generated by default as identity,
- content clob,
- obsolete bit not null,
- pos integer,
- revision integer,
- tf_id bigint,
- primary key (id),
- unique (revision, tf_id)
- );
- create table HTextFlowTarget (
- id bigint generated by default as identity,
- creationDate timestamp not null,
- lastChanged timestamp not null,
- versionNum integer not null,
- content clob not null,
- state integer not null,
- tf_revision integer not null,
- comment_id bigint,
- last_modified_by_id bigint,
- locale bigint not null,
- tf_id bigint,
- primary key (id),
- unique (locale, tf_id)
- );
- create table HTextFlowTargetHistory (
- id bigint generated by default as identity,
- content clob,
- lastChanged timestamp,
- state integer,
- tf_revision integer,
- versionNum integer,
- last_modified_by_id bigint,
- target_id bigint,
- primary key (id),
- unique (target_id, versionNum)
- );
- alter table HAccountActivationKey
- add constraint FK86E79CA4FA68C45F
- foreign key (accountId)
- references HAccount;
- alter table HAccountMembership
- add constraint FK9D5DB27B3E684F5E
- foreign key (memberOf)
- references HAccountRole;
- alter table HAccountMembership
- add constraint FK9D5DB27BFA68C45F
- foreign key (accountId)
- references HAccount;
- alter table HAccountResetPasswordKey
- add constraint FK85C9EFDAFA68C45F
- foreign key (accountId)
- references HAccount;
- alter table HAccountRoleGroup
- add constraint FK3321CC643E684F5E
- foreign key (memberOf)
- references HAccountRole;
- alter table HAccountRoleGroup
- add constraint FK3321CC642DF53D7E
- foreign key (roleId)
- references HAccountRole;
- alter table HCommunity
- add constraint FKD3DF208177D52F9
- foreign key (ownerId)
- references HPerson;
- alter table HCommunity_Member
- add constraint FK8BEBF03860C55B1B
- foreign key (personId)
- references HPerson;
- alter table HCommunity_Member
- add constraint FK8BEBF038AF83AE57
- foreign key (communityId)
- references HCommunity;
- alter table HCommunity_Officer
- add constraint FK5CB3E75860C55B1B
- foreign key (personId)
- references HPerson;
- alter table HCommunity_Officer
- add constraint FK5CB3E758AF83AE57
- foreign key (communityId)
- references HCommunity;
- alter table HDocument
- add constraint FKEA766D836C9BADC1
- foreign key (last_modified_by_id)
- references HPerson;
- alter table HDocument
- add constraint FKEA766D83FEA3B54A
- foreign key (locale)
- references HLocale;
- alter table HDocument
- add constraint FKEA766D8351ED6DFD
- foreign key (project_iteration_id)
- references HProjectIteration;
- alter table HDocument
- add constraint FKEA766D83136CC025
- foreign key (poHeader_id)
- references HPoHeader;
- alter table HDocumentHistory
- add constraint FK279765915383E2F0
- foreign key (document_id)
- references HDocument;
- alter table HDocumentHistory
- add constraint FK279765916C9BADC1
- foreign key (last_modified_by_id)
- references HPerson;
- alter table HDocumentHistory
- add constraint FK27976591FEA3B54A
- foreign key (locale)
- references HLocale;
- alter table HLocale_Member
- add constraint FK82DF50D760C55B1B
- foreign key (personId)
- references HPerson;
- alter table HLocale_Member
- add constraint FK82DF50D73A932491
- foreign key (supportedLanguageId)
- references HLocale;
- alter table HPerson
- add constraint FK6F0931BDFA68C45F
- foreign key (accountId)
- references HAccount;
- alter table HPoHeader
- add constraint FK9A0ABDD4B7A40DF2
- foreign key (comment_id)
- references HSimpleComment;
- alter table HPoTargetHeader
- add constraint FK1BC719855383E2F0
- foreign key (document_id)
- references HDocument;
- alter table HPoTargetHeader
- add constraint FK1BC719857D208AD9
- foreign key (targetLanguage)
- references HLocale;
- alter table HPoTargetHeader
- add constraint FK1BC71985B7A40DF2
- foreign key (comment_id)
- references HSimpleComment;
- alter table HPotEntryData
- add constraint FK17A648CFB7A40DF2
- foreign key (comment_id)
- references HSimpleComment;
- alter table HPotEntryData
- add constraint FK17A648CFCCAD9D19
- foreign key (tf_id)
- references HTextFlow;
- alter table HProjectIteration
- add constraint FK31C1E42C4BCEEA93
- foreign key (project_id)
- references HProject;
- alter table HProjectIteration
- add constraint FK31C1E42C5B1D181F
- foreign key (parentId)
- references HProjectIteration;
- alter table HProject_Maintainer
- add constraint FK1491F2E660C55B1B
- foreign key (personId)
- references HPerson;
- alter table HProject_Maintainer
- add constraint FK1491F2E665B5BB37
- foreign key (projectId)
- references HProject;
- alter table HTextFlow
- add constraint FK7B40F8635383E2F0
- foreign key (document_id)
- references HDocument;
- alter table HTextFlow
- add constraint FK7B40F8638D8E70A5
- foreign key (potEntryData_id)
- references HPotEntryData;
- alter table HTextFlow
- add constraint FK7B40F863B7A40DF2
- foreign key (comment_id)
- references HSimpleComment;
- alter table HTextFlowHistory
- add constraint FK46C4DEB1CCAD9D19
- foreign key (tf_id)
- references HTextFlow;
- alter table HTextFlowTarget
- add constraint FK1E933FD46C9BADC1
- foreign key (last_modified_by_id)
- references HPerson;
- alter table HTextFlowTarget
- add constraint FK1E933FD4FEA3B54A
- foreign key (locale)
- references HLocale;
- alter table HTextFlowTarget
- add constraint FK1E933FD4B7A40DF2
- foreign key (comment_id)
- references HSimpleComment;
- alter table HTextFlowTarget
- add constraint FK1E933FD4CCAD9D19
- foreign key (tf_id)
- references HTextFlow;
- alter table HTextFlowTargetHistory
- add constraint FKF10986206C9BADC1
- foreign key (last_modified_by_id)
- references HPerson;
- alter table HTextFlowTargetHistory
- add constraint FKF109862080727E8B
- foreign key (target_id)
- references HTextFlowTarget;