first what so ever registration

This commit is contained in:
Blue 2023-12-20 19:42:13 -03:00
parent 0c50cfa639
commit 99a9fd507e
Signed by: blue
GPG key ID: 9B203B252A63EE38
17 changed files with 285 additions and 25 deletions

View file

@ -17,17 +17,36 @@ CREATE TABLE IF NOT EXISTS accounts (
`login` VARCHAR(256) UNIQUE NOT NULL,
`nick` VARCHAR(256),
`type` INTEGER UNSIGNED NOT NULL,
`password` VARCHAR(64),
`salt` VARCHAR(32),
`role` INTEGER UNSIGNED NOT NULL,
`created` TIMESTAMP DEFAULT UTC_TIMESTAMP(),
`password` VARCHAR(128),
`created` TIMESTAMP DEFAULT UTC_TIMESTAMP()
);
--creating role bindings table
CREATE TABLE IF NOT EXISTS roleBindings (
`account` INTEGER UNSIGNED NOT NULL,
`role` INTEGER UNSIGNED NOT NULL,
PRIMARY KEY (account, role),
FOREIGN KEY (account) REFERENCES accounts(id),
FOREIGN KEY (role) REFERENCES roles(id)
);
--creating sessings table
CREATE TABLE IF NOT EXISTS sessions (
`id` INTEGER AUTO_INCREMENT PRIMARY KEY,
`owner` INTEGER UNSIGNED NOT NULL,
`started` TIMESTAMP DEFAULT UTC_TIMESTAMP(),
`latest` TIMESTAMP DEFAULT UTC_TIMESTAMP(),
`salt` CHAR(16),
`persist` BOOLEAN NOT NULL,
FOREIGN KEY (owner) REFERENCES accounts(id)
);
--creating defailt roles
INSERT IGNORE INTO roles (`name`)
VALUES ('root');
VALUES ('root'),
('default');
--inserting initial version
INSERT INTO system (`key`, `value`) VALUES ('version', '0');