Skip to content

Commit 2d3619e

Browse files
author
Bastian Gruber
committed
Updating migrations
1 parent 93d60c7 commit 2d3619e

11 files changed

+11
-5
lines changed

ch_09/migrations/20220408182019_extend_questions_table.sql

Lines changed: 0 additions & 2 deletions
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
DROP TABLE IF EXISTS questions;
File renamed without changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
DROP TABLE IF EXISTS answers;
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
-- Add migration script here
21
CREATE TABLE IF NOT EXISTS answers (
32
id serial PRIMARY KEY,
43
content TEXT NOT NULL,
54
created_on TIMESTAMP NOT NULL DEFAULT NOW(),
65
corresponding_question integer REFERENCES questions
7-
);
6+
);
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
DROP TABLE IF EXISTS accounts;

ch_09/migrations/20220328090805_add_accounts_table.sql renamed to ch_09/migrations/20220523174842_create_accounts_table.up.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ CREATE TABLE IF NOT EXISTS accounts (
22
id serial NOT NULL,
33
email VARCHAR(255) NOT NULL PRIMARY KEY,
44
password VARCHAR(255) NOT NULL
5-
);
5+
);
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ALTER TABLE questions
2+
DROP COLUMN account_id;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ALTER TABLE questions
2+
ADD COLUMN account_id serial;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ALTER TABLE answers
2+
DROP COLUMN account_id;

0 commit comments

Comments
 (0)