Compare commits
4 Commits
c18098cb8a
...
0ed010b78f
Author | SHA1 | Date | |
---|---|---|---|
0ed010b78f | |||
a6598ba5db | |||
2fba9080d6 | |||
053992e30c |
@ -1,5 +1,4 @@
|
|||||||
-- Add migration script here
|
-- Add migration script here
|
||||||
ALTER TABLE
|
|
||||||
users
|
ALTER TABLE users
|
||||||
ADD
|
ADD COLUMN language Text NOT NULL DEFAULT "en";
|
||||||
COLUMN language Text NOT NULL DEFAULT "en";
|
|
24
migrations/20210401070030_on_delete_cascade.sql
Normal file
24
migrations/20210401070030_on_delete_cascade.sql
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
-- Add migration script here
|
||||||
|
PRAGMA foreign_keys = off;
|
||||||
|
|
||||||
|
|
||||||
|
CREATE TABLE new_clicks (
|
||||||
|
id INTEGER PRIMARY KEY NOT NULL,
|
||||||
|
link INT NOT NULL,
|
||||||
|
created_at TIMESTAMP NOT NULL,
|
||||||
|
FOREIGN KEY (link) REFERENCES links (id) ON DELETE CASCADE
|
||||||
|
);
|
||||||
|
|
||||||
|
INSERT INTO
|
||||||
|
new_clicks
|
||||||
|
SELECT
|
||||||
|
*
|
||||||
|
FROM
|
||||||
|
clicks;
|
||||||
|
|
||||||
|
|
||||||
|
DROP TABLE clicks;
|
||||||
|
ALTER TABLE
|
||||||
|
new_clicks RENAME TO clicks;
|
||||||
|
|
||||||
|
PRAGMA foreign_keys = on;
|
@ -64,7 +64,7 @@ impl actix_web::error::ResponseError for ServerError {
|
|||||||
match self {
|
match self {
|
||||||
Self::Argonautic => HttpResponse::InternalServerError().json("Argonautica Error"),
|
Self::Argonautic => HttpResponse::InternalServerError().json("Argonautica Error"),
|
||||||
Self::Database(e) => {
|
Self::Database(e) => {
|
||||||
HttpResponse::InternalServerError().json(format!("Diesel Error: {:?}", e))
|
HttpResponse::InternalServerError().json(format!("Database Error: {:?}", e))
|
||||||
}
|
}
|
||||||
Self::DatabaseMigration(_) => {
|
Self::DatabaseMigration(_) => {
|
||||||
unimplemented!("A migration error should never be rendered")
|
unimplemented!("A migration error should never be rendered")
|
||||||
|
Loading…
Reference in New Issue
Block a user