text: # --- Created by Ebean DDL
  # To stop Ebean DDL generation, remove this comment and start using Evolutions
  
  # --- !Ups
  
  create table category (
    id                            bigint not null,
    name                          varchar(255),
    constraint pk_category primary key (id)
  );
  create sequence category_seq;
  
  create table category_product (
    category_id                   bigint not null,
    product_id                    bigint not null,
    constraint pk_category_product primary key (category_id,product_id)
  );
  
  create table product (
    id                            bigint not null,
    name                          varchar(255),
    description                   varchar(255),
    stock                         integer,
    price                         double,
    constraint pk_product primary key (id)
  );
  create sequence product_seq;
  
  create table user (
    role                          varchar(255),
    email                         varchar(255) not null,
    name                          varchar(255),
    password                      varchar(255),
    department                    varchar(255),
    street1                       varchar(255),
    street2                       varchar(255),
    town                          varchar(255),
    post_code                     varchar(255),
    credit_card                   varchar(255),
    constraint pk_user primary key (email)
  );
  
  alter table category_product add constraint fk_category_product_category foreign key (category_id) references category (id) on delete restrict on update restrict;
  create index ix_category_product_category on category_product (category_id);
  
  alter table category_product add constraint fk_category_product_product foreign key (product_id) references product (id) on delete restrict on update restrict;
  create index ix_category_product_product on category_product (product_id);
  
  
  # --- !Downs
  
  alter table category_product drop constraint if exists fk_category_product_category;
  drop index if exists ix_category_product_category;
  
  alter table category_product drop constraint if exists fk_category_product_product;
  drop index if exists ix_category_product_product;
  
  drop table if exists category;
  drop sequence if exists category_seq;
  
  drop table if exists category_product;
  
  drop table if exists product;
  drop sequence if exists product_seq;
  
  drop table if exists user;
  
  