text: CREATE TABLE WN_TASK (
  	ID INT,
  	WN_TASK_THEME_ID INT,
  	CREATED DATETIME CONSTRAINT wn_task_nn01 NOT NULL,
  	CLOSED DATETIME,
  	TEXT NVarChar(3000),
  	TASK_PRIORITY NVarChar(6) CONSTRAINT wn_task_nn02 NOT NULL,
  	TASK_STATE NVarChar(11) CONSTRAINT wn_task_nn03 NOT NULL,
  	CONSTRAINT wn_task_pk PRIMARY KEY (ID));
  go
  
  ALTER TABLE WN_TASK ADD CONSTRAINT wn_task_cc01 CHECK (TASK_PRIORITY in ('NONE', 'LOW', 'MEDIUM', 'HIGH', 'TOP'));
  go
  
  ALTER TABLE WN_TASK ADD CONSTRAINT wn_task_cc02 CHECK (TASK_STATE in ('OPENED', 'IN_PROGRESS', 'PENDING', 'CLOSED'));
  go
  
  CREATE TABLE WN_TASK_THEME (
  	WN_TASK_THEME_ID  INT,
  	NAME NVarChar (200) CONSTRAINT wn_task_theme_nn01 NOT NULL,
  	DESCRIPTION VARCHAR(max),
  	STATE NVarChar(7) CONSTRAINT wn_task_theme_nn02 NOT NULL,
  	CREATED DATETIME CONSTRAINT wn_task_theme_nn03 NOT NULL,
  	CLOSED DATETIME,
  	CONSTRAINT wn_task_theme_pk PRIMARY KEY (WN_TASK_THEME_ID)
  );
  go
  
  ALTER TABLE WN_TASK_THEME ADD CONSTRAINT wn_task_theme_cc01 CHECK (STATE in ('VALID', 'INVALID'));
  go
  
  ALTER TABLE WN_TASK ADD CONSTRAINT wn_task_fk01 FOREIGN KEY (WN_TASK_THEME_ID) REFERENCES WN_TASK_THEME (WN_TASK_THEME_ID);
  go
  
  CREATE SEQUENCE task_sequence START WITH 1000000;
  go
  
  CREATE SEQUENCE task_theme_sequence START WITH 1000000;
  go
  
  CREATE TABLE WN_USER (
  	WN_USER_ID INT,
  	NAME NVarChar(30) CONSTRAINT wn_user_nn01 NOT NULL,
  	EMAIL NVarChar(50) CONSTRAINT wn_user_nn02 NOT NULL,
  	PASSWORD NVarChar(100) CONSTRAINT wn_user_nn03 NOT NULL,
  	ACTIVE NVarChar(1) CONSTRAINT wn_user_nn04 NOT NULL,
  	CONSTRAINT wn_user_pk PRIMARY KEY (WN_USER_ID)
  );
  go
  
  ALTER TABLE WN_USER ADD CONSTRAINT wn_user_cc01 CHECK (ACTIVE in ('Y', 'N'));
  go
  
  ALTER TABLE WN_USER ADD CONSTRAINT wn_user_uq01 UNIQUE (EMAIL);
  go
  
  CREATE TABLE WN_USER_ROLE (
  	WN_USER_ID INT,
  	WN_ROLE_ID INT
  );
  go
  
  CREATE SEQUENCE user_sequence START WITH 1000000;
  go
  
  CREATE SEQUENCE role_sequence START WITH 1000000;
  
  ALTER TABLE WN_TASK ADD WN_USER_ID INT;
  go
  
  ALTER TABLE WN_TASK_THEME ADD WN_USER_ID INT;
  go
  
  CREATE TABLE WN_ROLE (
  	WN_ROLE_ID INT,
  	NAME NVarChar(20) CONSTRAINT wn_role_nn01 NOT NULL,
  	CONSTRAINT wn_role_pk PRIMARY KEY (WN_ROLE_ID)
  );
  go
  
  /* ODTIALTO NESPUSTENE*/
  