From 11faebef90ffbea4ce8bbf519ddd33c3efbcfd5a Mon Sep 17 00:00:00 2001
From: adela
Date: Mon, 18 Mar 2024 17:22:44 +0800
Subject: [PATCH 1/2] feat: add user table without not null
---
migrations/1001_create_user.down.sql | 1 +
migrations/1001_create_user.up.sql | 6 ++++++
migrations/1002_create_post.down.sql | 1 +
migrations/1002_create_post.up.sql | 4 ++++
4 files changed, 12 insertions(+)
create mode 100644 migrations/1001_create_user.down.sql
create mode 100644 migrations/1001_create_user.up.sql
create mode 100644 migrations/1002_create_post.down.sql
create mode 100644 migrations/1002_create_post.up.sql
diff --git a/migrations/1001_create_user.down.sql b/migrations/1001_create_user.down.sql
new file mode 100644
index 0000000..ec80768
--- /dev/null
+++ b/migrations/1001_create_user.down.sql
@@ -0,0 +1 @@
+DROP TABLE user;
\ No newline at end of file
diff --git a/migrations/1001_create_user.up.sql b/migrations/1001_create_user.up.sql
new file mode 100644
index 0000000..84465ad
--- /dev/null
+++ b/migrations/1001_create_user.up.sql
@@ -0,0 +1,6 @@
+CREATE TABLE "user" (
+ "id" SERIAL NOT NULL,
+ "firstName" character varying,
+ "lastName" character varying,
+ "age" integer NOT NULL
+);
\ No newline at end of file
diff --git a/migrations/1002_create_post.down.sql b/migrations/1002_create_post.down.sql
new file mode 100644
index 0000000..5fe4274
--- /dev/null
+++ b/migrations/1002_create_post.down.sql
@@ -0,0 +1 @@
+DROP TABLE post;
\ No newline at end of file
diff --git a/migrations/1002_create_post.up.sql b/migrations/1002_create_post.up.sql
new file mode 100644
index 0000000..58b276a
--- /dev/null
+++ b/migrations/1002_create_post.up.sql
@@ -0,0 +1,4 @@
+CREATE TABLE "post" (
+ "id" SERIAL,
+ "author" TEXT
+);
\ No newline at end of file
From 010cd5e556c0f8536e85a4bcea90c189359d97a5 Mon Sep 17 00:00:00 2001
From: adela
Date: Mon, 18 Mar 2024 17:36:44 +0800
Subject: [PATCH 2/2] feat: add user table with not null
---
migrations/1001_create_user.up.sql | 4 ++--
migrations/1002_create_post.up.sql | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/migrations/1001_create_user.up.sql b/migrations/1001_create_user.up.sql
index 84465ad..e2d7f1b 100644
--- a/migrations/1001_create_user.up.sql
+++ b/migrations/1001_create_user.up.sql
@@ -1,6 +1,6 @@
CREATE TABLE "user" (
"id" SERIAL NOT NULL,
- "firstName" character varying,
- "lastName" character varying,
+ "firstName" character varying NOT NULL,
+ "lastName" character varying NOT NULL,
"age" integer NOT NULL
);
\ No newline at end of file
diff --git a/migrations/1002_create_post.up.sql b/migrations/1002_create_post.up.sql
index 58b276a..647c226 100644
--- a/migrations/1002_create_post.up.sql
+++ b/migrations/1002_create_post.up.sql
@@ -1,4 +1,4 @@
CREATE TABLE "post" (
- "id" SERIAL,
- "author" TEXT
+ "id" SERIAL NOT NULL,
+ "author" TEXT NOT NULL
);
\ No newline at end of file