/*=============================================================*/
/*== http://www.postgresql.org/docs/8.1/static/datatype.html ==*/
/*=============================================================*/

CREATE SEQUENCE S_TABLE_TEST;

/*=============================================================*/
/* Table : TABLE_TEST                                          */
/*=============================================================*/
CREATE TABLE TABLE_TEST  (
   TABLE_TEST_ID        NUMERIC                     NOT NULL,
   CODE                 VARCHAR(50)                 NOT NULL,
   VALUE                INTEGER,
   IS_VISIBLE           BOOLEAN                     DEFAULT FALSE NOT NULL,
   DEFAULT_TRANSLATION  VARCHAR(255),
   CONSTRAINT PK_TABLE_TEST PRIMARY KEY (TABLE_TEST_ID),
   CONSTRAINT AK_TABLE_TEST_CO_ACH_ACHI UNIQUE (CODE)
);

COMMENT ON TABLE TABLE_TEST IS 'Table de test';
COMMENT ON COLUMN TABLE_TEST.TABLE_TEST_ID IS 'The identifier of the element';
COMMENT ON COLUMN TABLE_TEST.CODE IS 'The element code';
COMMENT ON COLUMN TABLE_TEST.VALUE IS 'The element value';
COMMENT ON COLUMN TABLE_TEST.IS_VISIBLE IS 'Test for a boolean';
COMMENT ON COLUMN TABLE_TEST.DEFAULT_TRANSLATION IS 'The default translation of the element';


/*=============================================================*/
/* INSERTS                                                     */
/*=============================================================*/
INSERT INTO table_test VALUES (nextval('S_TABLE_TEST'),'code_test_1','6548','FALSE','code test translation 1');
INSERT INTO table_test VALUES (nextval('S_TABLE_TEST'),'code_test_2','789','TRUE','code test translation 2');
INSERT INTO table_test VALUES (nextval('S_TABLE_TEST'),'code_test_3','1234','FALSE','code test translation 3');