Skip to content

Commit

Permalink
add deleted column
Browse files Browse the repository at this point in the history
  • Loading branch information
xerosanyam committed Jun 28, 2024
1 parent 0399d4a commit 555f6fb
Show file tree
Hide file tree
Showing 4 changed files with 352 additions and 0 deletions.
1 change: 1 addition & 0 deletions migrations/0002_dapper_inertia.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE `card` ADD `deleted` integer DEFAULT false NOT NULL;
343 changes: 343 additions & 0 deletions migrations/meta/0002_snapshot.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,343 @@
{
"version": "6",
"dialect": "sqlite",
"id": "9fc13483-d39d-4945-a07a-47a468ecb826",
"prevId": "c7952378-d69a-40ba-b25b-d969973fa0ec",
"tables": {
"activity": {
"name": "activity",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true,
"autoincrement": false
},
"action": {
"name": "action",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"card_id": {
"name": "card_id",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"user_id": {
"name": "user_id",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"created_at": {
"name": "created_at",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "(unixepoch())"
}
},
"indexes": {},
"foreignKeys": {
"activity_card_id_card_id_fk": {
"name": "activity_card_id_card_id_fk",
"tableFrom": "activity",
"tableTo": "card",
"columnsFrom": [
"card_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
},
"activity_user_id_auth_user_id_fk": {
"name": "activity_user_id_auth_user_id_fk",
"tableFrom": "activity",
"tableTo": "auth_user",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"card": {
"name": "card",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true,
"autoincrement": false
},
"front": {
"name": "front",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"back": {
"name": "back",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"user_id": {
"name": "user_id",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"easiness": {
"name": "easiness",
"type": "real",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": 2.5
},
"interval": {
"name": "interval",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": 1
},
"repetitions": {
"name": "repetitions",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": 0
},
"next_practice": {
"name": "next_practice",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "(unixepoch())"
},
"deleted": {
"name": "deleted",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": false
},
"created_at": {
"name": "created_at",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "(unixepoch())"
},
"updated_at": {
"name": "updated_at",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "(unixepoch())"
}
},
"indexes": {},
"foreignKeys": {
"card_user_id_auth_user_id_fk": {
"name": "card_user_id_auth_user_id_fk",
"tableFrom": "card",
"tableTo": "auth_user",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"user_session": {
"name": "user_session",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true,
"autoincrement": false
},
"expires_at": {
"name": "expires_at",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "(unixepoch())"
},
"user_id": {
"name": "user_id",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"created_at": {
"name": "created_at",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "(unixepoch())"
},
"updated_at": {
"name": "updated_at",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "(unixepoch())"
}
},
"indexes": {},
"foreignKeys": {
"user_session_user_id_auth_user_id_fk": {
"name": "user_session_user_id_auth_user_id_fk",
"tableFrom": "user_session",
"tableTo": "auth_user",
"columnsFrom": [
"user_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
},
"auth_user": {
"name": "auth_user",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true,
"autoincrement": false
},
"name": {
"name": "name",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"given_name": {
"name": "given_name",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"family_name": {
"name": "family_name",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"picture": {
"name": "picture",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"email": {
"name": "email",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"email_verified": {
"name": "email_verified",
"type": "integer",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"locale": {
"name": "locale",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"created_at": {
"name": "created_at",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "(unixepoch())"
},
"updated_at": {
"name": "updated_at",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "(unixepoch())"
}
},
"indexes": {
"auth_user_email_unique": {
"name": "auth_user_email_unique",
"columns": [
"email"
],
"isUnique": true
}
},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {}
}
},
"enums": {},
"_meta": {
"schemas": {},
"tables": {},
"columns": {}
}
}
7 changes: 7 additions & 0 deletions migrations/meta/_journal.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@
"when": 1719460026182,
"tag": "0001_plain_stingray",
"breakpoints": true
},
{
"idx": 2,
"version": "6",
"when": 1719589235789,
"tag": "0002_dapper_inertia",
"breakpoints": true
}
]
}
1 change: 1 addition & 0 deletions src/lib/db/turso.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export const cardTable = sqliteTable('card', {
interval: integer('interval').notNull().default(1),
repetitions: integer('repetitions').notNull().default(0),
nextPractice: integer('next_practice', { mode: 'timestamp' }).default(sql`(unixepoch())`).notNull(),
deleted: integer('deleted', { mode: 'boolean' }).default(false).notNull(),
createdAt: integer('created_at', { mode: 'timestamp' }).default(sql`(unixepoch())`).notNull(),
updatedAt: integer('updated_at', { mode: 'timestamp' }).default(sql`(unixepoch())`).$onUpdate(() => new Date()).notNull(),
})
Expand Down

0 comments on commit 555f6fb

Please sign in to comment.