From 385d5e092d700b5620efaebded2ca3b2c09802e2 Mon Sep 17 00:00:00 2001 From: Valentin Kuznetsov Date: Tue, 12 Dec 2023 14:46:40 -0500 Subject: [PATCH] Add unique contrain to different tables --- web/schemas/mysql.sql | 10 +++++----- web/schemas/sqlite.sql | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/web/schemas/mysql.sql b/web/schemas/mysql.sql index 42e49be..f8233b6 100644 --- a/web/schemas/mysql.sql +++ b/web/schemas/mysql.sql @@ -1,21 +1,21 @@ CREATE TABLE cycles ( cycle_id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, - name VARCHAR(100) NOT NULL + name VARCHAR(100) NOT NULL UNIQUE ); CREATE TABLE beamlines ( beamline_id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, - name VARCHAR(100) NOT NULL + name VARCHAR(100) NOT NULL UNIQUE ); CREATE TABLE btrs ( btr_id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, - name VARCHAR(100) NOT NULL + name VARCHAR(100) NOT NULL UNIQUE ); CREATE TABLE samples ( sample_id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, - name VARCHAR(100) NOT NULL + name VARCHAR(100) NOT NULL UNIQUE ); CREATE TABLE datasets ( @@ -30,5 +30,5 @@ CREATE TABLE datasets ( CREATE TABLE files ( file_id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, dataset_id BIGINT REFERENCES datasets(dataset_id) ON UPDATE CASCADE, - name VARCHAR(100) NOT NULL + name VARCHAR(100) NOT NULL UNIQUE ); diff --git a/web/schemas/sqlite.sql b/web/schemas/sqlite.sql index ddf6a7e..7c0dc0a 100644 --- a/web/schemas/sqlite.sql +++ b/web/schemas/sqlite.sql @@ -2,22 +2,22 @@ CREATE TABLE cycles ( cycle_id INTEGER PRIMARY KEY AUTOINCREMENT, - name TEXT NOT NULL + name TEXT NOT NULL UNIQUE ); CREATE TABLE beamlines ( beamline_id INTEGER PRIMARY KEY AUTOINCREMENT, - name TEXT NOT NULL + name TEXT NOT NULL UNIQUE ); CREATE TABLE btrs ( btr_id INTEGER PRIMARY KEY AUTOINCREMENT, - name TEXT NOT NULL + name TEXT NOT NULL UNIQUE ); CREATE TABLE samples ( sample_id INTEGER PRIMARY KEY AUTOINCREMENT, - name TEXT NOT NULL + name TEXT NOT NULL UNIQUE ); CREATE TABLE datasets ( @@ -32,6 +32,6 @@ CREATE TABLE datasets ( CREATE TABLE files ( file_id INTEGER PRIMARY KEY AUTOINCREMENT, dataset_id INTEGER REFERENCES datasets(dataset_id) ON UPDATE CASCADE, - name TEXT NOT NULL + name TEXT NOT NULL UNIQUE );