#71 Curăță scripturile de inițializare sql, având în vedere că acum folosim migrations
state: closed opened by: adrianharabula on: 5/11/2017
Comments
from: adrianharabula on: 5/21/2017
Cam aşa arată baza noastră de date generată cu migrările din laravel
-- Generated by Oracle SQL Developer Data Modeler 4.2.0.932
-- at: 2017-05-21 23:52:58 EEST
-- site: Oracle Database 11g
-- type: Oracle Database 11g
CREATE TABLESPACE aplicatie_condr
-- WARNING: Tablespace has no data files defined
LOGGING ONLINE EXTENT MANAGEMENT LOCAL AUTOALLOCATE FLASHBACK ON;
CREATE USER CONDR
IDENTIFIED BY
ACCOUNT UNLOCK
;
CREATE TABLE condr.categories (
id NUMBER(10) NOT NULL,
name VARCHAR2(255 BYTE) NOT NULL,
description VARCHAR2(255 BYTE) NOT NULL,
created_at TIMESTAMP,
updated_at TIMESTAMP
)
PCTFREE 10 PCTUSED 40 TABLESPACE aplicatie_condr LOGGING
STORAGE ( INITIAL 65536 NEXT 1048576 PCTINCREASE 0 MINEXTENTS 1 MAXEXTENTS 2147483645 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT );
CREATE UNIQUE INDEX condr.categories_id_pk ON
condr.categories ( id ASC )
TABLESPACE aplicatie_condr PCTFREE 10
STORAGE ( INITIAL 65536 NEXT 1048576 PCTINCREASE 0 MINEXTENTS 1 MAXEXTENTS 2147483645 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT )
LOGGING;
CREATE UNIQUE INDEX condr.categories_name_uk ON
condr.categories ( name ASC )
TABLESPACE aplicatie_condr PCTFREE 10
STORAGE ( INITIAL 65536 NEXT 1048576 PCTINCREASE 0 MINEXTENTS 1 MAXEXTENTS 2147483645 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT )
LOGGING;
ALTER TABLE condr.categories ADD CONSTRAINT categories_id_pk PRIMARY KEY ( id )
USING INDEX condr.categories_id_pk;
ALTER TABLE condr.categories ADD CONSTRAINT categories_name_uk UNIQUE ( name )
USING INDEX condr.categories_name_uk;
CREATE TABLE condr.characteristics (
id NUMBER(10) NOT NULL,
name VARCHAR2(255 BYTE) NOT NULL,
created_at TIMESTAMP,
updated_at TIMESTAMP
)
PCTFREE 10 PCTUSED 40 TABLESPACE aplicatie_condr LOGGING
STORAGE ( INITIAL 65536 NEXT 1048576 PCTINCREASE 0 MINEXTENTS 1 MAXEXTENTS 2147483645 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT );
CREATE UNIQUE INDEX condr.characteristics_id_pk ON
condr.characteristics ( id ASC )
TABLESPACE aplicatie_condr PCTFREE 10
STORAGE ( INITIAL 65536 NEXT 1048576 PCTINCREASE 0 MINEXTENTS 1 MAXEXTENTS 2147483645 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT )
LOGGING;
CREATE UNIQUE INDEX condr.characteristics_name_uk ON
condr.characteristics ( name ASC )
TABLESPACE aplicatie_condr PCTFREE 10
STORAGE ( INITIAL 65536 NEXT 1048576 PCTINCREASE 0 MINEXTENTS 1 MAXEXTENTS 2147483645 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT )
LOGGING;
ALTER TABLE condr.characteristics ADD CONSTRAINT characteristics_id_pk PRIMARY KEY ( id )
USING INDEX condr.characteristics_id_pk;
ALTER TABLE condr.characteristics ADD CONSTRAINT characteristics_name_uk UNIQUE ( name )
USING INDEX condr.characteristics_name_uk;
CREATE TABLE condr.characterizable (
characteristic_id NUMBER(10) NOT NULL,
characteristic_values VARCHAR2(4000 BYTE) NOT NULL,
characterizable_id NUMBER(10) NOT NULL,
characterizable_type VARCHAR2(255 BYTE) NOT NULL,
created_at TIMESTAMP,
updated_at TIMESTAMP
)
PCTFREE 10 PCTUSED 40 TABLESPACE aplicatie_condr LOGGING
STORAGE ( INITIAL 65536 NEXT 1048576 PCTINCREASE 0 MINEXTENTS 1 MAXEXTENTS 2147483645 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT );
CREATE INDEX condr.characterizable_characterizabl ON
condr.characterizable (
characterizable_id
ASC,
characterizable_type
ASC )
TABLESPACE aplicatie_condr PCTFREE 10
STORAGE ( INITIAL 65536 NEXT 1048576 PCTINCREASE 0 MINEXTENTS 1 MAXEXTENTS 2147483645 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT )
LOGGING;
CREATE TABLE condr.companies (
id NUMBER(10) NOT NULL,
name VARCHAR2(255 BYTE) NOT NULL,
description VARCHAR2(255 BYTE) NOT NULL,
views NUMBER(10),
created_at TIMESTAMP,
updated_at TIMESTAMP
)
PCTFREE 10 PCTUSED 40 TABLESPACE aplicatie_condr LOGGING
STORAGE ( INITIAL 65536 NEXT 1048576 PCTINCREASE 0 MINEXTENTS 1 MAXEXTENTS 2147483645 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT );
CREATE UNIQUE INDEX condr.companies_id_pk ON
condr.companies ( id ASC )
TABLESPACE aplicatie_condr PCTFREE 10
STORAGE ( INITIAL 65536 NEXT 1048576 PCTINCREASE 0 MINEXTENTS 1 MAXEXTENTS 2147483645 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT )
LOGGING;
CREATE UNIQUE INDEX condr.companies_name_uk ON
condr.companies ( name ASC )
TABLESPACE aplicatie_condr PCTFREE 10
STORAGE ( INITIAL 65536 NEXT 1048576 PCTINCREASE 0 MINEXTENTS 1 MAXEXTENTS 2147483645 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT )
LOGGING;
ALTER TABLE condr.companies ADD CONSTRAINT companies_id_pk PRIMARY KEY ( id )
USING INDEX condr.companies_id_pk;
ALTER TABLE condr.companies ADD CONSTRAINT companies_name_uk UNIQUE ( name )
USING INDEX condr.companies_name_uk;
CREATE TABLE condr.condrgroup_user (
id NUMBER(10) NOT NULL,
user_id NUMBER(10) NOT NULL,
condrgroup_id NUMBER(10) NOT NULL
)
PCTFREE 10 PCTUSED 40 TABLESPACE aplicatie_condr LOGGING
STORAGE ( INITIAL 65536 NEXT 1048576 PCTINCREASE 0 MINEXTENTS 1 MAXEXTENTS 2147483645 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT );
CREATE UNIQUE INDEX condr.condrgroup_user_id_pk ON
condr.condrgroup_user ( id ASC )
TABLESPACE aplicatie_condr PCTFREE 10
STORAGE ( INITIAL 65536 NEXT 1048576 PCTINCREASE 0 MINEXTENTS 1 MAXEXTENTS 2147483645 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT )
LOGGING;
ALTER TABLE condr.condrgroup_user ADD CONSTRAINT condrgroup_user_id_pk PRIMARY KEY ( id )
USING INDEX condr.condrgroup_user_id_pk;
CREATE TABLE condr.condrgroups (
id NUMBER(10) NOT NULL,
name VARCHAR2(255 BYTE) NOT NULL,
description VARCHAR2(255 BYTE)
)
PCTFREE 10 PCTUSED 40 TABLESPACE aplicatie_condr LOGGING
STORAGE ( INITIAL 65536 NEXT 1048576 PCTINCREASE 0 MINEXTENTS 1 MAXEXTENTS 2147483645 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT );
CREATE UNIQUE INDEX condr.condrgroups_id_pk ON
condr.condrgroups ( id ASC )
TABLESPACE aplicatie_condr PCTFREE 10
STORAGE ( INITIAL 65536 NEXT 1048576 PCTINCREASE 0 MINEXTENTS 1 MAXEXTENTS 2147483645 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT )
LOGGING;
CREATE UNIQUE INDEX condr.condrgroups_name_uk ON
condr.condrgroups ( name ASC )
TABLESPACE aplicatie_condr PCTFREE 10
STORAGE ( INITIAL 65536 NEXT 1048576 PCTINCREASE 0 MINEXTENTS 1 MAXEXTENTS 2147483645 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT )
LOGGING;
ALTER TABLE condr.condrgroups ADD CONSTRAINT condrgroups_id_pk PRIMARY KEY ( id )
USING INDEX condr.condrgroups_id_pk;
ALTER TABLE condr.condrgroups ADD CONSTRAINT condrgroups_name_uk UNIQUE ( name )
USING INDEX condr.condrgroups_name_uk;
CREATE TABLE condr.migrations (
id NUMBER(10) NOT NULL,
migration VARCHAR2(255 BYTE) NOT NULL,
batch NUMBER(10) NOT NULL
)
PCTFREE 10 PCTUSED 40 TABLESPACE aplicatie_condr LOGGING
STORAGE ( INITIAL 65536 NEXT 1048576 PCTINCREASE 0 MINEXTENTS 1 MAXEXTENTS 2147483645 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT );
CREATE UNIQUE INDEX condr.migrations_id_pk ON
condr.migrations ( id ASC )
TABLESPACE aplicatie_condr PCTFREE 10
STORAGE ( INITIAL 65536 NEXT 1048576 PCTINCREASE 0 MINEXTENTS 1 MAXEXTENTS 2147483645 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT )
LOGGING;
ALTER TABLE condr.migrations ADD CONSTRAINT migrations_id_pk PRIMARY KEY ( id )
USING INDEX condr.migrations_id_pk;
CREATE TABLE condr.password_resets (
email VARCHAR2(255 BYTE) NOT NULL,
token VARCHAR2(255 BYTE) NOT NULL,
created_at TIMESTAMP
)
PCTFREE 10 PCTUSED 40 TABLESPACE aplicatie_condr LOGGING
STORAGE ( INITIAL 65536 NEXT 1048576 PCTINCREASE 0 MINEXTENTS 1 MAXEXTENTS 2147483645 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT );
CREATE INDEX condr.password_resets_email_index ON
condr.password_resets ( email ASC )
TABLESPACE aplicatie_condr PCTFREE 10
STORAGE ( INITIAL 65536 NEXT 1048576 PCTINCREASE 0 MINEXTENTS 1 MAXEXTENTS 2147483645 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT )
LOGGING;
CREATE TABLE condr.product_user (
id NUMBER(10) NOT NULL,
user_id NUMBER(10) NOT NULL,
product_id NUMBER(10) NOT NULL
)
PCTFREE 10 PCTUSED 40 TABLESPACE aplicatie_condr LOGGING
STORAGE ( INITIAL 65536 NEXT 1048576 PCTINCREASE 0 MINEXTENTS 1 MAXEXTENTS 2147483645 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT );
CREATE UNIQUE INDEX condr.product_user_id_pk ON
condr.product_user ( id ASC )
TABLESPACE aplicatie_condr PCTFREE 10
STORAGE ( INITIAL 65536 NEXT 1048576 PCTINCREASE 0 MINEXTENTS 1 MAXEXTENTS 2147483645 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT )
LOGGING;
ALTER TABLE condr.product_user ADD CONSTRAINT product_user_id_pk PRIMARY KEY ( id )
USING INDEX condr.product_user_id_pk;
CREATE TABLE condr.products (
id NUMBER(10) NOT NULL,
upc_code VARCHAR2(255 BYTE),
name VARCHAR2(255 BYTE) NOT NULL,
description VARCHAR2(255 BYTE),
image_url VARCHAR2(255 BYTE),
views NUMBER(10),
category_id NUMBER(10),
company_id NUMBER(10),
created_at TIMESTAMP,
updated_at TIMESTAMP,
deleted_at TIMESTAMP
)
PCTFREE 10 PCTUSED 40 TABLESPACE aplicatie_condr LOGGING
STORAGE ( INITIAL 65536 NEXT 1048576 PCTINCREASE 0 MINEXTENTS 1 MAXEXTENTS 2147483645 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT );
CREATE UNIQUE INDEX condr.products_id_pk ON
condr.products ( id ASC )
TABLESPACE aplicatie_condr PCTFREE 10
STORAGE ( INITIAL 65536 NEXT 1048576 PCTINCREASE 0 MINEXTENTS 1 MAXEXTENTS 2147483645 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT )
LOGGING;
ALTER TABLE condr.products ADD CONSTRAINT products_id_pk PRIMARY KEY ( id )
USING INDEX condr.products_id_pk;
CREATE TABLE condr.users (
id NUMBER(10) NOT NULL,
name VARCHAR2(255 BYTE) NOT NULL,
email VARCHAR2(255 BYTE) NOT NULL,
"password" VARCHAR2(255 BYTE) NOT NULL,
remember_token VARCHAR2(100 BYTE),
created_at TIMESTAMP,
updated_at TIMESTAMP
)
PCTFREE 10 PCTUSED 40 TABLESPACE aplicatie_condr LOGGING
STORAGE ( INITIAL 65536 NEXT 1048576 PCTINCREASE 0 MINEXTENTS 1 MAXEXTENTS 2147483645 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT );
CREATE UNIQUE INDEX condr.users_email_uk ON
condr.users ( email ASC )
TABLESPACE aplicatie_condr PCTFREE 10
STORAGE ( INITIAL 65536 NEXT 1048576 PCTINCREASE 0 MINEXTENTS 1 MAXEXTENTS 2147483645 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT )
LOGGING;
CREATE UNIQUE INDEX condr.users_id_pk ON
condr.users ( id ASC )
TABLESPACE aplicatie_condr PCTFREE 10
STORAGE ( INITIAL 65536 NEXT 1048576 PCTINCREASE 0 MINEXTENTS 1 MAXEXTENTS 2147483645 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT )
LOGGING;
ALTER TABLE condr.users ADD CONSTRAINT users_id_pk PRIMARY KEY ( id )
USING INDEX condr.users_id_pk;
ALTER TABLE condr.users ADD CONSTRAINT users_email_uk UNIQUE ( email )
USING INDEX condr.users_email_uk;
ALTER TABLE condr.characterizable ADD CONSTRAINT characterizable_characteristic FOREIGN KEY ( characteristic_id )
REFERENCES condr.characteristics ( id )
NOT DEFERRABLE;
ALTER TABLE condr.condrgroup_user ADD CONSTRAINT condrgroup_user_condrgroup_id_ FOREIGN KEY ( condrgroup_id )
REFERENCES condr.condrgroups ( id )
ON DELETE CASCADE
NOT DEFERRABLE;
ALTER TABLE condr.condrgroup_user ADD CONSTRAINT condrgroup_user_user_id_fk FOREIGN KEY ( user_id )
REFERENCES condr.users ( id )
ON DELETE CASCADE
NOT DEFERRABLE;
ALTER TABLE condr.product_user ADD CONSTRAINT product_user_product_id_fk FOREIGN KEY ( product_id )
REFERENCES condr.products ( id )
ON DELETE CASCADE
NOT DEFERRABLE;
ALTER TABLE condr.product_user ADD CONSTRAINT product_user_user_id_fk FOREIGN KEY ( user_id )
REFERENCES condr.users ( id )
ON DELETE CASCADE
NOT DEFERRABLE;
ALTER TABLE condr.products ADD CONSTRAINT products_category_id_fk FOREIGN KEY ( category_id )
REFERENCES condr.categories ( id )
NOT DEFERRABLE;
ALTER TABLE condr.products ADD CONSTRAINT products_company_id_fk FOREIGN KEY ( company_id )
REFERENCES condr.companies ( id )
NOT DEFERRABLE;
CREATE SEQUENCE condr.categories_id_seq START WITH 1 NOCACHE ORDER;
CREATE OR REPLACE TRIGGER condr.categories_id_trg BEFORE
INSERT ON condr.categories
FOR EACH ROW
WHEN (
new.id IS NULL
)
BEGIN
:new.id := condr.categories_id_seq.nextval;
END;
/
CREATE SEQUENCE condr.characteristics_id_seq START WITH 1 NOCACHE ORDER;
CREATE OR REPLACE TRIGGER condr.characteristics_id_trg BEFORE
INSERT ON condr.characteristics
FOR EACH ROW
WHEN (
new.id IS NULL
)
BEGIN
:new.id := condr.characteristics_id_seq.nextval;
END;
/
CREATE SEQUENCE condr.companies_id_seq START WITH 1 NOCACHE ORDER;
CREATE OR REPLACE TRIGGER condr.companies_id_trg BEFORE
INSERT ON condr.companies
FOR EACH ROW
WHEN (
new.id IS NULL
)
BEGIN
:new.id := condr.companies_id_seq.nextval;
END;
/
CREATE SEQUENCE condr.condrgroup_user_id_seq START WITH 1 NOCACHE ORDER;
CREATE OR REPLACE TRIGGER condr.condrgroup_user_id_trg BEFORE
INSERT ON condr.condrgroup_user
FOR EACH ROW
WHEN (
new.id IS NULL
)
BEGIN
:new.id := condr.condrgroup_user_id_seq.nextval;
END;
/
CREATE SEQUENCE condr.condrgroups_id_seq START WITH 1 NOCACHE ORDER;
CREATE OR REPLACE TRIGGER condr.condrgroups_id_trg BEFORE
INSERT ON condr.condrgroups
FOR EACH ROW
WHEN (
new.id IS NULL
)
BEGIN
:new.id := condr.condrgroups_id_seq.nextval;
END;
/
CREATE SEQUENCE condr.migrations_id_seq START WITH 1 NOCACHE ORDER;
CREATE OR REPLACE TRIGGER condr.migrations_id_trg BEFORE
INSERT ON condr.migrations
FOR EACH ROW
WHEN (
new.id IS NULL
)
BEGIN
:new.id := condr.migrations_id_seq.nextval;
END;
/
CREATE SEQUENCE condr.product_user_id_seq START WITH 1 NOCACHE ORDER;
CREATE OR REPLACE TRIGGER condr.product_user_id_trg BEFORE
INSERT ON condr.product_user
FOR EACH ROW
WHEN (
new.id IS NULL
)
BEGIN
:new.id := condr.product_user_id_seq.nextval;
END;
/
CREATE SEQUENCE condr.products_id_seq START WITH 1 NOCACHE ORDER;
CREATE OR REPLACE TRIGGER condr.products_id_trg BEFORE
INSERT ON condr.products
FOR EACH ROW
WHEN (
new.id IS NULL
)
BEGIN
:new.id := condr.products_id_seq.nextval;
END;
/
CREATE SEQUENCE condr.users_id_seq START WITH 1 NOCACHE ORDER;
CREATE OR REPLACE TRIGGER condr.users_id_trg BEFORE
INSERT ON condr.users
FOR EACH ROW
WHEN (
new.id IS NULL
)
BEGIN
:new.id := condr.users_id_seq.nextval;
END;
/
-- Oracle SQL Developer Data Modeler Summary Report:
--
-- CREATE TABLE 11
-- CREATE INDEX 16
-- ALTER TABLE 21
-- CREATE VIEW 0
-- ALTER VIEW 0
-- CREATE PACKAGE 0
-- CREATE PACKAGE BODY 0
-- CREATE PROCEDURE 0
-- CREATE FUNCTION 0
-- CREATE TRIGGER 9
-- ALTER TRIGGER 0
-- CREATE COLLECTION TYPE 0
-- CREATE STRUCTURED TYPE 0
-- CREATE STRUCTURED TYPE BODY 0
-- CREATE CLUSTER 0
-- CREATE CONTEXT 0
-- CREATE DATABASE 0
-- CREATE DIMENSION 0
-- CREATE DIRECTORY 0
-- CREATE DISK GROUP 0
-- CREATE ROLE 0
-- CREATE ROLLBACK SEGMENT 0
-- CREATE SEQUENCE 9
-- CREATE MATERIALIZED VIEW 0
-- CREATE SYNONYM 0
-- CREATE TABLESPACE 1
-- CREATE USER 1
--
-- DROP TABLESPACE 0
-- DROP DATABASE 0
--
-- REDACTION POLICY 0
--
-- ORDS DROP SCHEMA 0
-- ORDS ENABLE SCHEMA 0
-- ORDS ENABLE OBJECT 0
--
-- ERRORS 0
-- WARNINGS 1
from: adrianharabula on: 6/6/2017
Done, curăţat.