
    create table article (
        id varchar2(255 char) not null,
        code varchar2(255 char),
        description varchar2(255 char),
        direct_withdraw_allowed number(1,0) not null,
        fixed_locations_first number(1,0) not null,
        unit varchar2(255 char),
        company varchar2(255 char),
        supplier varchar2(255 char),
        primary key (id)
    );

    create table article_fixed_locations (
        article varchar2(255 char) not null,
        fixed_locations varchar2(255 char) not null,
        primary key (article, fixed_locations)
    );

    create table building (
        id varchar2(255 char) not null,
        code varchar2(255 char),
        company varchar2(255 char),
        primary key (id)
    );

    create table company (
        id varchar2(255 char) not null,
        name varchar2(255 char),
        primary key (id)
    );

    create table delivered_requested_article (
        id varchar2(255 char) not null,
        requested_article varchar2(255 char),
        storage_movement_order varchar2(255 char),
        primary key (id)
    );

    create table delivered_requested_list (
        id varchar2(255 char) not null,
        status varchar2(255 char),
        affected_to varchar2(255 char),
        requested_list varchar2(255 char),
        primary key (id)
    );

    create table kanban (
        id varchar2(255 char) not null,
        required_quantity double precision not null,
        article varchar2(255 char),
        warehouse varchar2(255 char),
        primary key (id)
    );

    create table location (
        id varchar2(255 char) not null,
        code varchar2(255 char),
        full_location number(1,0) not null,
        required_accreditation_level number(10,0) not null,
        required_crane_man number(1,0) not null,
        warehouse varchar2(255 char),
        primary key (id)
    );

    create table location_error (
        id varchar2(255 char) not null,
        report_date timestamp,
        article varchar2(255 char),
        location varchar2(255 char),
        magalie_user varchar2(255 char),
        primary key (id)
    );

    create table magalie_user (
        id varchar2(255 char) not null,
        accreditation_level number(10,0) not null,
        crane_man number(1,0) not null,
        driver_license number(1,0) not null,
        login varchar2(255 char),
        name varchar2(255 char),
        company varchar2(255 char),
        primary key (id)
    );

    create table prepared_article_reception (
        id varchar2(255 char) not null,
        barcode varchar2(255 char),
        quantity double precision not null,
        article varchar2(255 char),
        primary key (id)
    );

    create table rece_prep_arti_rece_stor_move (
        receiv_prepar_articl_recept varchar2(255 char) not null,
        storage_movements varchar2(255 char) not null,
        primary key (receiv_prepar_articl_recept, storage_movements),
        unique (storage_movements)
    );

    create table receiv_prepar_articl_recept (
        id varchar2(255 char) not null,
        prepared_article_reception varchar2(255 char),
        primary key (id)
    );

    create table requested_article (
        id varchar2(255 char) not null,
        quantity double precision not null,
        article varchar2(255 char),
        destination_location varchar2(255 char),
        requested_list varchar2(255 char),
        primary key (id)
    );

    create table requested_list (
        id varchar2(255 char) not null,
        code varchar2(255 char),
        list_type varchar2(255 char),
        request_date timestamp,
        urgent number(1,0) not null,
        building varchar2(255 char),
        primary key (id)
    );

    create table stora_movem_order_stora_movem (
        storage_movement_order varchar2(255 char) not null,
        storage_movements varchar2(255 char) not null,
        storage_movements_order number(10,0) not null,
        primary key (storage_movement_order, storage_movements_order),
        unique (storage_movements)
    );

    create table storage_movement (
        id varchar2(255 char) not null,
        actual_quantity double precision,
        confirm_date timestamp,
        expected_quantity double precision not null,
        order_date timestamp,
        article varchar2(255 char),
        destination_location varchar2(255 char),
        magalie_user varchar2(255 char),
        origin_location varchar2(255 char),
        primary key (id)
    );

    create table storage_movement_order (
        id varchar2(255 char) not null,
        primary key (id)
    );

    create table stored_article (
        id varchar2(255 char) not null,
        batch_code varchar2(255 char),
        quantity double precision not null,
        article varchar2(255 char),
        location varchar2(255 char),
        primary key (id)
    );

    create table supplier (
        id varchar2(255 char) not null,
        name varchar2(255 char),
        primary key (id)
    );

    create table unavailable_article (
        id varchar2(255 char) not null,
        report_date timestamp,
        article varchar2(255 char),
        building varchar2(255 char),
        primary key (id)
    );

    create table warehouse (
        id varchar2(255 char) not null,
        code varchar2(255 char),
        withdraw_allowed number(1,0) not null,
        building varchar2(255 char),
        primary key (id)
    );

    alter table article
        add constraint FKD458CCF62370ECD2
        foreign key (company)
        references company;

    alter table article
        add constraint FKD458CCF6CBE3FAC0
        foreign key (supplier)
        references supplier;

    alter table article_fixed_locations
        add constraint FK8ABDEF0A5AD40DC4
        foreign key (article)
        references article;

    alter table article_fixed_locations
        add constraint FK8ABDEF0AD49C1F30
        foreign key (fixed_locations)
        references location;

    alter table building
        add constraint FKAABA12B42370ECD2
        foreign key (company)
        references company;

    alter table delivered_requested_article
        add constraint FK4DD96E2AB3FA51F5
        foreign key (requested_article)
        references requested_article;

    alter table delivered_requested_article
        add constraint FK4DD96E2A7911364E
        foreign key (storage_movement_order)
        references storage_movement_order;

    alter table delivered_requested_list
        add constraint FK1894BBEA4467E543
        foreign key (affected_to)
        references magalie_user;

    alter table delivered_requested_list
        add constraint FK1894BBEA4DF9CDD3
        foreign key (requested_list)
        references requested_list;

    alter table kanban
        add constraint FKBC20EF375AD40DC4
        foreign key (article)
        references article;

    alter table kanban
        add constraint FKBC20EF37C533535E
        foreign key (warehouse)
        references warehouse;

    alter table location
        add constraint FK714F9FB5C533535E
        foreign key (warehouse)
        references warehouse;

    alter table location_error
        add constraint FK78578FE74CB4692
        foreign key (location)
        references location;

    alter table location_error
        add constraint FK78578FE5AD40DC4
        foreign key (article)
        references article;

    alter table location_error
        add constraint FK78578FE94A6F7AD
        foreign key (magalie_user)
        references magalie_user;

    alter table magalie_user
        add constraint FK5FFE0E902370ECD2
        foreign key (company)
        references company;

    alter table prepared_article_reception
        add constraint FK391C73445AD40DC4
        foreign key (article)
        references article;

    alter table rece_prep_arti_rece_stor_move
        add constraint FK8383BA5321EFCD02
        foreign key (storage_movements)
        references storage_movement;

    alter table rece_prep_arti_rece_stor_move
        add constraint FK8383BA53DC900D84
        foreign key (receiv_prepar_articl_recept)
        references receiv_prepar_articl_recept;

    alter table receiv_prepar_articl_recept
        add constraint FK463DE85C01B8F42
        foreign key (prepared_article_reception)
        references prepared_article_reception;

    alter table requested_article
        add constraint FK8125BD256C3AE3A3
        foreign key (destination_location)
        references location;

    alter table requested_article
        add constraint FK8125BD255AD40DC4
        foreign key (article)
        references article;

    alter table requested_article
        add constraint FK8125BD254DF9CDD3
        foreign key (requested_list)
        references requested_list;

    alter table requested_list
        add constraint FKBD0C46CFE7A02C90
        foreign key (building)
        references building;

    alter table stora_movem_order_stora_movem
        add constraint FK1D27094421EFCD02
        foreign key (storage_movements)
        references storage_movement;

    alter table stora_movem_order_stora_movem
        add constraint FK1D2709447911364E
        foreign key (storage_movement_order)
        references storage_movement_order;

    alter table storage_movement
        add constraint FK63FA89F36C3AE3A3
        foreign key (destination_location)
        references location;

    alter table storage_movement
        add constraint FK63FA89F3FAAA738B
        foreign key (origin_location)
        references location;

    alter table storage_movement
        add constraint FK63FA89F35AD40DC4
        foreign key (article)
        references article;

    alter table storage_movement
        add constraint FK63FA89F394A6F7AD
        foreign key (magalie_user)
        references magalie_user;

    alter table stored_article
        add constraint FKDA7C445A74CB4692
        foreign key (location)
        references location;

    alter table stored_article
        add constraint FKDA7C445A5AD40DC4
        foreign key (article)
        references article;

    alter table unavailable_article
        add constraint FK2748FC07E7A02C90
        foreign key (building)
        references building;

    alter table unavailable_article
        add constraint FK2748FC075AD40DC4
        foreign key (article)
        references article;

    alter table warehouse
        add constraint FK88EF3AC3E7A02C90
        foreign key (building)
        references building;

    create sequence hibernate_sequence;
