diff --git a/source/demyo-model/src/main/resources/org/demyo/model/schema/V1__Initial_structure.sql b/source/demyo-model/src/main/resources/org/demyo/model/schema/V1__Initial_structure.sql index c3912ac4..b9dbeb71 100644 --- a/source/demyo-model/src/main/resources/org/demyo/model/schema/V1__Initial_structure.sql +++ b/source/demyo-model/src/main/resources/org/demyo/model/schema/V1__Initial_structure.sql @@ -1,12 +1,12 @@ CREATE TABLE images ( - id INT AUTO_INCREMENT PRIMARY KEY, + id INT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, url VARCHAR(255) NOT NULL, description VARCHAR(255) NULL ); CREATE INDEX ON images(description); CREATE TABLE publishers ( - id INT AUTO_INCREMENT PRIMARY KEY, + id INT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, name VARCHAR(255) NOT NULL, website VARCHAR(255) NULL, feed VARCHAR(255) NULL, @@ -17,7 +17,7 @@ CREATE TABLE publishers ( CREATE INDEX ON publishers(name); CREATE TABLE collections ( - id INT AUTO_INCREMENT PRIMARY KEY, + id INT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, name VARCHAR(255) NOT NULL, website VARCHAR(255) NULL, feed VARCHAR(255) NULL, @@ -30,7 +30,7 @@ CREATE TABLE collections ( CREATE INDEX ON collections(name); CREATE TABLE authors ( - id INT AUTO_INCREMENT PRIMARY KEY, + id INT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, name VARCHAR(127) NOT NULL, fname VARCHAR(127) NULL, nickname VARCHAR(127) NULL, @@ -42,7 +42,7 @@ CREATE TABLE authors ( CREATE INDEX ON authors(name); CREATE TABLE series ( - id INT AUTO_INCREMENT PRIMARY KEY, + id INT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, name VARCHAR(255) NOT NULL, summary CLOB NULL, completed BOOLEAN DEFAULT 'false', @@ -61,12 +61,12 @@ CREATE TABLE series_relations ( CREATE INDEX ON series_relations(main); CREATE TABLE bindings ( - id INT AUTO_INCREMENT PRIMARY KEY, + id INT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, name VARCHAR(255) NOT NULL ); CREATE TABLE albums ( - id INT AUTO_INCREMENT PRIMARY KEY, + id INT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, series_id INT NULL, /* One shots have no series */ cycle SMALLINT NULL, number FLOAT NULL, @@ -148,7 +148,7 @@ CREATE TABLE albums_translators ( ); CREATE TABLE tags ( - id INT AUTO_INCREMENT PRIMARY KEY, + id INT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, name VARCHAR(127) NOT NULL UNIQUE, fgcolour CHAR(7) DEFAULT NULL, bgcolour CHAR(7) DEFAULT NULL @@ -164,7 +164,7 @@ CREATE TABLE albums_tags ( ); CREATE TABLE sources ( - id INT AUTO_INCREMENT PRIMARY KEY, + id INT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, name VARCHAR(127) NOT NULL, owner VARCHAR(127) NULL, email VARCHAR(255) NULL, @@ -175,12 +175,12 @@ CREATE TABLE sources ( ); CREATE TABLE derivative_types ( - id INT AUTO_INCREMENT PRIMARY KEY, + id INT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, name VARCHAR(127) NOT NULL ); CREATE TABLE derivatives ( - id INT AUTO_INCREMENT PRIMARY KEY, + id INT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, series_id INT NULL, /* Since Albums may not have a Series, Derivatives could as well */ album_id INT NULL, artist_id INT NULL, @@ -223,7 +223,7 @@ CREATE TABLE derivatives_images ( ); CREATE TABLE borrowers ( - id INT AUTO_INCREMENT PRIMARY KEY, + id INT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, name VARCHAR(127) NOT NULL, fname VARCHAR(127) NULL, email VARCHAR(255) NULL, @@ -241,7 +241,7 @@ CREATE TABLE albums_borrowers ( ); CREATE TABLE searches ( - id INT AUTO_INCREMENT PRIMARY KEY, + id INT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, model VARCHAR(255) NOT NULL, /* The kind of item being searched. */ status VARCHAR(63) NOT NULL, /* The status. Either temporary or saved. */ name VARCHAR(255) NULL, /* User-specified name */ diff --git a/source/demyo-model/src/main/resources/org/demyo/model/schema/V3__Configuration.sql b/source/demyo-model/src/main/resources/org/demyo/model/schema/V3__Configuration.sql index 5a499810..2fbde977 100644 --- a/source/demyo-model/src/main/resources/org/demyo/model/schema/V3__Configuration.sql +++ b/source/demyo-model/src/main/resources/org/demyo/model/schema/V3__Configuration.sql @@ -1,5 +1,5 @@ CREATE TABLE configuration ( - id INT AUTO_INCREMENT PRIMARY KEY, + id INT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, config_key VARCHAR(255) NOT NULL, config_value VARCHAR(2048) NULL ); diff --git a/source/demyo-model/src/main/resources/org/demyo/model/schema/V4__Demyo_2.1.sql b/source/demyo-model/src/main/resources/org/demyo/model/schema/V4__Demyo_2.1.sql index ccdc177b..e031156c 100644 --- a/source/demyo-model/src/main/resources/org/demyo/model/schema/V4__Demyo_2.1.sql +++ b/source/demyo-model/src/main/resources/org/demyo/model/schema/V4__Demyo_2.1.sql @@ -16,7 +16,7 @@ ALTER TABLE derivatives -- Create the table CREATE TABLE readers ( - id INT AUTO_INCREMENT PRIMARY KEY, + id INT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY, name VARCHAR(255) NOT NULL, colour CHAR(7) DEFAULT NULL );