fix: store refresh-at as string type, not date type, for sqlx autotyping
This commit is contained in:
parent
4a0ed99329
commit
6d6018aa32
2 changed files with 17 additions and 1 deletions
3
Taskfile
3
Taskfile
|
|
@ -12,7 +12,8 @@ refresh_sqlx_db() {
|
|||
rm -f some_user.db
|
||||
for migration in migrations/each_user/*.sql; do
|
||||
echo "Applying $migration..."
|
||||
sqlite3 some_user.db < "$migration"
|
||||
echo "BEGIN TRANSACTION;$(cat "$migration");COMMIT TRANSACTION;"\
|
||||
| sqlite3 some_user.db
|
||||
done
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,12 @@
|
|||
-- foreign_keys can only up/down outside of transactions
|
||||
-- so we first pre-commit the one started by sqlx...
|
||||
COMMIT TRANSACTION;
|
||||
|
||||
-- turn off foreign keys...
|
||||
PRAGMA foreign_keys=OFF;
|
||||
|
||||
-- start our own transaction...
|
||||
BEGIN TRANSACTION;
|
||||
create table if not exists new_contacts (
|
||||
id integer primary key autoincrement,
|
||||
birthday text,
|
||||
|
|
@ -16,4 +23,12 @@ insert into new_contacts (
|
|||
drop table contacts;
|
||||
alter table new_contacts rename to contacts;
|
||||
PRAGMA foreign_key_check;
|
||||
|
||||
-- commit our own transaction...
|
||||
COMMIT TRANSACTION;
|
||||
|
||||
-- put our own pragmas back...
|
||||
PRAGMA foreign_keys=ON;
|
||||
|
||||
-- and start a dummy transaction so sqlx's COMMIT doesn't explode
|
||||
BEGIN TRANSACTION;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue