Skip to content

Commit

Permalink
fix: add notnull to tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
veryCrunchy committed May 3, 2024
1 parent 7e66939 commit 6ccc731
Show file tree
Hide file tree
Showing 4 changed files with 376 additions and 21 deletions.
2 changes: 2 additions & 0 deletions src/db/migrations/0003_chunky_captain_america.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE `user_accounts` MODIFY COLUMN `access_token` varchar(100) NOT NULL;--> statement-breakpoint
ALTER TABLE `user_accounts` MODIFY COLUMN `refresh_token` varchar(100) NOT NULL;
346 changes: 346 additions & 0 deletions src/db/migrations/meta/0003_snapshot.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,346 @@
{
"version": "5",
"dialect": "mysql",
"id": "74da8b5c-fb2f-46e8-846a-a94597c4f633",
"prevId": "a7d39fc7-e7e2-487f-a9b5-f47a74375f75",
"tables": {
"user_accounts": {
"name": "user_accounts",
"columns": {
"id": {
"name": "id",
"type": "varchar(100)",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"username": {
"name": "username",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"display_name": {
"name": "display_name",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"email": {
"name": "email",
"type": "varchar(255)",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"avatar": {
"name": "avatar",
"type": "varchar(255)",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"user_id": {
"name": "user_id",
"type": "varchar(100)",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"platform": {
"name": "platform",
"type": "enum('twitch','discord')",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"scope": {
"name": "scope",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"access_token": {
"name": "access_token",
"type": "varchar(100)",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"refresh_token": {
"name": "refresh_token",
"type": "varchar(100)",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"expires_at": {
"name": "expires_at",
"type": "datetime",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"created_at": {
"name": "created_at",
"type": "datetime",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"updated_at": {
"name": "updated_at",
"type": "datetime",
"primaryKey": false,
"notNull": true,
"autoincrement": false
}
},
"indexes": {},
"foreignKeys": {
"user_accounts_user_id_users_id_fk": {
"name": "user_accounts_user_id_users_id_fk",
"tableFrom": "user_accounts",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "restrict"
}
},
"compositePrimaryKeys": {
"user_accounts_id": {
"name": "user_accounts_id",
"columns": [
"id"
]
}
},
"uniqueConstraints": {}
},
"minecraft_users": {
"name": "minecraft_users",
"columns": {
"id": {
"name": "id",
"type": "varchar(36)",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"user_id": {
"name": "user_id",
"type": "varchar(100)",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"whitelisted": {
"name": "whitelisted",
"type": "boolean",
"primaryKey": false,
"notNull": false,
"autoincrement": false,
"default": true
},
"created_at": {
"name": "created_at",
"type": "datetime",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"updated_at": {
"name": "updated_at",
"type": "datetime",
"primaryKey": false,
"notNull": true,
"autoincrement": false
}
},
"indexes": {},
"foreignKeys": {
"minecraft_users_user_id_users_id_fk": {
"name": "minecraft_users_user_id_users_id_fk",
"tableFrom": "minecraft_users",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {
"minecraft_users_id": {
"name": "minecraft_users_id",
"columns": [
"id"
]
}
},
"uniqueConstraints": {
"minecraft_users_id_unique": {
"name": "minecraft_users_id_unique",
"columns": [
"id"
]
}
}
},
"sessions": {
"name": "sessions",
"columns": {
"id": {
"name": "id",
"type": "varchar(100)",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"user_id": {
"name": "user_id",
"type": "varchar(100)",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"token": {
"name": "token",
"type": "varchar(255)",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"expires_at": {
"name": "expires_at",
"type": "datetime",
"primaryKey": false,
"notNull": true,
"autoincrement": false
}
},
"indexes": {},
"foreignKeys": {
"sessions_user_id_users_id_fk": {
"name": "sessions_user_id_users_id_fk",
"tableFrom": "sessions",
"tableTo": "users",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {
"sessions_id": {
"name": "sessions_id",
"columns": [
"id"
]
}
},
"uniqueConstraints": {
"sessions_token_unique": {
"name": "sessions_token_unique",
"columns": [
"token"
]
}
}
},
"users": {
"name": "users",
"columns": {
"id": {
"name": "id",
"type": "varchar(100)",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"scope": {
"name": "scope",
"type": "varchar(255)",
"primaryKey": false,
"notNull": false,
"autoincrement": false,
"default": "'group:default'"
},
"primary_account_id": {
"name": "primary_account_id",
"type": "varchar(100)",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"created_at": {
"name": "created_at",
"type": "datetime",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"updated_at": {
"name": "updated_at",
"type": "datetime",
"primaryKey": false,
"notNull": true,
"autoincrement": false
}
},
"indexes": {},
"foreignKeys": {
"users_primary_account_id_user_accounts_id_fk": {
"name": "users_primary_account_id_user_accounts_id_fk",
"tableFrom": "users",
"tableTo": "user_accounts",
"columnsFrom": [
"primary_account_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "restrict"
}
},
"compositePrimaryKeys": {
"users_id": {
"name": "users_id",
"columns": [
"id"
]
}
},
"uniqueConstraints": {
"users_primary_account_id_unique": {
"name": "users_primary_account_id_unique",
"columns": [
"primary_account_id"
]
}
}
}
},
"schemas": {},
"_meta": {
"schemas": {},
"tables": {},
"columns": {}
}
}
45 changes: 26 additions & 19 deletions src/db/migrations/meta/_journal.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
{
"version": "5",
"dialect": "mysql",
"entries": [
{
"idx": 1,
"version": "5",
"when": 1710590750600,
"tag": "0001_spooky_preak",
"breakpoints": true
},
{
"idx": 2,
"version": "5",
"when": 1712709120522,
"tag": "0002_overrated_tinkerer",
"breakpoints": true
}
]
}
"version": "5",
"dialect": "mysql",
"entries": [
{
"idx": 1,
"version": "5",
"when": 1710590750600,
"tag": "0001_spooky_preak",
"breakpoints": true
},
{
"idx": 2,
"version": "5",
"when": 1712709120522,
"tag": "0002_overrated_tinkerer",
"breakpoints": true
},
{
"idx": 3,
"version": "5",
"when": 1714756313829,
"tag": "0003_chunky_captain_america",
"breakpoints": true
}
]
}
Loading

0 comments on commit 6ccc731

Please sign in to comment.