Files
ebean/ebean-ddl-generator/src/test/resources/assert/ModelBuild_explicitSequencesTest/apply.sql
T
2022-03-21 11:02:14 +01:00

20 lines
827 B
SQL

create table PERSONS (
ID bigint generated by default as identity (start with 1000 increment by 40) not null,
SURNAME varchar(64) not null,
NAME varchar(64) not null,
constraint pk_persons primary key (ID)
);
create table PHONES (
id bigint generated by default as identity not null,
phone_number varchar(7) not null,
person_id bigint not null,
constraint uq_phones_phone_number unique (phone_number),
constraint pk_phones primary key (id)
);
-- foreign keys and indices
create index ix_phones_person_id on PHONES (person_id);
alter table PHONES add constraint fk_phones_person_id foreign key (person_id) references PERSONS (ID) on delete restrict on update restrict;