1
0
Fork 0
mirror of https://github.com/Lynnesbian/FediBooks/ synced 2024-11-25 16:48:58 +00:00

make user_id an AI int to allow for signing up with an email previously used by someone else

This commit is contained in:
Lynne Megido 2019-09-01 19:53:38 +10:00
parent 20b0c46046
commit cae7cfe8c2
2 changed files with 5 additions and 5 deletions

View file

@ -1,11 +1,11 @@
USE `fedibooks`; USE `fedibooks`;
CREATE TABLE IF NOT EXISTS `users` ( CREATE TABLE IF NOT EXISTS `users` (
`id` BINARY(64) PRIMARY KEY, `id` INT AUTO_INCREMENT PRIMARY KEY,
`email` VARCHAR(128) UNIQUE NOT NULL, `email` VARCHAR(128) UNIQUE NOT NULL,
`password` BINARY(60) NOT NULL `password` BINARY(60) NOT NULL
) ENGINE=INNODB; ) ENGINE=INNODB;
CREATE TABLE IF NOT EXISTS `contact_settings` ( CREATE TABLE IF NOT EXISTS `contact_settings` (
`user_id` BINARY(64) NOT NULL, `user_id` INT NOT NULL,
`fetch` ENUM('always', 'once', 'never') DEFAULT 'once', `fetch` ENUM('always', 'once', 'never') DEFAULT 'once',
`submit` ENUM('always', 'once', 'never') DEFAULT 'once', `submit` ENUM('always', 'once', 'never') DEFAULT 'once',
`generation` ENUM('always', 'once', 'never') DEFAULT 'once', `generation` ENUM('always', 'once', 'never') DEFAULT 'once',
@ -20,7 +20,7 @@ CREATE TABLE IF NOT EXISTS `credentials` (
) ENGINE=INNODB; ) ENGINE=INNODB;
CREATE TABLE IF NOT EXISTS `bots` ( CREATE TABLE IF NOT EXISTS `bots` (
`id` BINARY(64) PRIMARY KEY, `id` BINARY(64) PRIMARY KEY,
`user_id` BINARY(64) NOT NULL, `user_id` INT NOT NULL,
`credentials_id` INT NOT NULL, `credentials_id` INT NOT NULL,
`enabled` BOOLEAN DEFAULT 1, `enabled` BOOLEAN DEFAULT 1,
`replies_enabled` BOOLEAN DEFAULT 1, `replies_enabled` BOOLEAN DEFAULT 1,
@ -59,7 +59,7 @@ CREATE TABLE IF NOT EXISTS `word_blacklist` (
FOREIGN KEY (`bot_id`) REFERENCES bots(id) ON DELETE CASCADE FOREIGN KEY (`bot_id`) REFERENCES bots(id) ON DELETE CASCADE
) ENGINE=INNODB; ) ENGINE=INNODB;
CREATE TABLE IF NOT EXISTS `contact_history` ( CREATE TABLE IF NOT EXISTS `contact_history` (
`user_id` BINARY(64) NOT NULL, `user_id` INT NOT NULL,
`fetch` BOOLEAN DEFAULT 0, `fetch` BOOLEAN DEFAULT 0,
`submit` BOOLEAN DEFAULT 0, `submit` BOOLEAN DEFAULT 0,
`generation` BOOLEAN DEFAULT 0, `generation` BOOLEAN DEFAULT 0,

View file

@ -82,7 +82,7 @@ def do_signup():
# try to sign up # try to sign up
c = mysql.connection.cursor() c = mysql.connection.cursor()
c.execute("INSERT INTO `users` (id, email, password) VALUES (%s, %s, %s)", (user_id, request.form['email'], pw)) c.execute("INSERT INTO `users` (email, password) VALUES (%s, %s)", (request.form['email'], pw))
mysql.connection.commit() mysql.connection.commit()
c.close() c.close()