diff --git a/database/init.d/init-en_GB.sql b/database/init.d/init-en_GB.sql index 629473c..44e9727 100644 --- a/database/init.d/init-en_GB.sql +++ b/database/init.d/init-en_GB.sql @@ -1,3 +1,25 @@ +/* + * Copyright (c) 2024-2026 OnixByte + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + /** * IMPORTANT NOTE ON DATABASE CREATION: * * If you intend to create the database using a user other than the one specified @@ -85,31 +107,28 @@ VALUES (1, 'HR Manager', 'HR-MGR', DROP TABLE IF EXISTS users CASCADE; CREATE TABLE users ( - id BIGINT PRIMARY KEY, - username VARCHAR(64) UNIQUE NOT NULL, - password VARCHAR(255), - full_name VARCHAR(128) NOT NULL, - email VARCHAR(128) UNIQUE, - region_code VARCHAR(10), - phone_number VARCHAR(32), - avatar_url TEXT, - status USER_STATUS NOT NULL DEFAULT 'ACTIVE', - department_id BIGINT REFERENCES departments (id), - position_id BIGINT REFERENCES positions (id), - created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, - updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP + id BIGINT PRIMARY KEY, + username VARCHAR(64) UNIQUE NOT NULL, + password VARCHAR(255), + full_name VARCHAR(128) NOT NULL, + email VARCHAR(128) NULL UNIQUE, + region_abbreviation VARCHAR(10) NULL, + phone_number VARCHAR(32) NULL, + avatar_url TEXT, + status USER_STATUS NOT NULL DEFAULT 'ACTIVE', + department_id BIGINT REFERENCES departments (id), + position_id BIGINT REFERENCES positions (id), + created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + UNIQUE (region_abbreviation, phone_number) ); CREATE INDEX users_username_index ON users (username); ---- Users Table Indexes --- -CREATE UNIQUE INDEX uidx_users_region_abbreviation_phone_number - ON users (region_abbreviation, phone_number); - --- Users Data Insertion --- -- NOTE: All phone numbers are generated by ChatGPT, they should not be connected any real person. -INSERT INTO users(id, username, password, full_name, email, region_abbreviation, phone_number, avatar_url, - department_id, position_id, created_at, updated_at) +INSERT INTO users(id, username, password, full_name, email, region_abbreviation, phone_number, + avatar_url, department_id, position_id, created_at, updated_at) VALUES (1, 'helix', null, 'Helix Admin', 'admin@helix.onixbyte.dev', 'GB', '7000000000', 'https://gravatar.com/avatar/6ef4c4033f6aa8e43d06bd5e462a6173cc2a960633473721a6f1289cd1b5146f', 1, 1, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP), @@ -310,14 +329,14 @@ CREATE TABLE menus status STATUS NOT NULL DEFAULT 'ACTIVE'::STATUS, authority_code VARCHAR(128) NULL DEFAULT NULL, icon VARCHAR(128) NULL DEFAULT NULL, - create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, - update_time TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP + created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + updated_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP ); CREATE UNIQUE INDEX menus_code_uindex ON menus (code); INSERT INTO menus(id, name, parent_id, code, sort, path, is_external_link, is_visible, status, - authority_code, icon, create_time, update_time) + authority_code, icon, created_at, updated_at) VALUES (1, '系统管理', NULL, 'system-manage', 99, NULL, FALSE, TRUE, 'ACTIVE'::STATUS, NULL, NULL, NOW(), NOW()), (2, '用户管理', 1, 'user-manage', 1, '/users', FALSE, TRUE, 'ACTIVE'::STATUS,