-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add missing migration to getting-started example (#174)
- Loading branch information
Showing
10 changed files
with
660 additions
and
2 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
examples/getting_started/.butane/migrations/20240115_023841384_dbconstraints/Blog.table
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
"name": "Blog", | ||
"columns": [ | ||
{ | ||
"name": "id", | ||
"sqltype": { | ||
"KnownId": { | ||
"Ty": "BigInt" | ||
} | ||
}, | ||
"nullable": false, | ||
"pk": true, | ||
"auto": true, | ||
"unique": false, | ||
"default": null | ||
}, | ||
{ | ||
"name": "name", | ||
"sqltype": { | ||
"KnownId": { | ||
"Ty": "Text" | ||
} | ||
}, | ||
"nullable": false, | ||
"pk": false, | ||
"auto": false, | ||
"unique": false, | ||
"default": null | ||
} | ||
] | ||
} |
102 changes: 102 additions & 0 deletions
102
examples/getting_started/.butane/migrations/20240115_023841384_dbconstraints/Post.table
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
{ | ||
"name": "Post", | ||
"columns": [ | ||
{ | ||
"name": "id", | ||
"sqltype": { | ||
"KnownId": { | ||
"Ty": "Int" | ||
} | ||
}, | ||
"nullable": false, | ||
"pk": true, | ||
"auto": true, | ||
"unique": false, | ||
"default": null | ||
}, | ||
{ | ||
"name": "title", | ||
"sqltype": { | ||
"KnownId": { | ||
"Ty": "Text" | ||
} | ||
}, | ||
"nullable": false, | ||
"pk": false, | ||
"auto": false, | ||
"unique": false, | ||
"default": null | ||
}, | ||
{ | ||
"name": "body", | ||
"sqltype": { | ||
"KnownId": { | ||
"Ty": "Text" | ||
} | ||
}, | ||
"nullable": false, | ||
"pk": false, | ||
"auto": false, | ||
"unique": false, | ||
"default": null | ||
}, | ||
{ | ||
"name": "published", | ||
"sqltype": { | ||
"KnownId": { | ||
"Ty": "Bool" | ||
} | ||
}, | ||
"nullable": false, | ||
"pk": false, | ||
"auto": false, | ||
"unique": false, | ||
"default": null | ||
}, | ||
{ | ||
"name": "blog", | ||
"sqltype": { | ||
"KnownId": { | ||
"Ty": "BigInt" | ||
} | ||
}, | ||
"nullable": false, | ||
"pk": false, | ||
"auto": false, | ||
"unique": false, | ||
"default": null, | ||
"reference": { | ||
"Literal": { | ||
"table_name": "Blog", | ||
"column_name": "id" | ||
} | ||
} | ||
}, | ||
{ | ||
"name": "byline", | ||
"sqltype": { | ||
"KnownId": { | ||
"Ty": "Text" | ||
} | ||
}, | ||
"nullable": true, | ||
"pk": false, | ||
"auto": false, | ||
"unique": false, | ||
"default": null | ||
}, | ||
{ | ||
"name": "likes", | ||
"sqltype": { | ||
"KnownId": { | ||
"Ty": "Int" | ||
} | ||
}, | ||
"nullable": false, | ||
"pk": false, | ||
"auto": false, | ||
"unique": false, | ||
"default": null | ||
} | ||
] | ||
} |
43 changes: 43 additions & 0 deletions
43
.../getting_started/.butane/migrations/20240115_023841384_dbconstraints/Post_tags_Many.table
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
{ | ||
"name": "Post_tags_Many", | ||
"columns": [ | ||
{ | ||
"name": "owner", | ||
"sqltype": { | ||
"KnownId": { | ||
"Ty": "Int" | ||
} | ||
}, | ||
"nullable": false, | ||
"pk": false, | ||
"auto": false, | ||
"unique": false, | ||
"default": null, | ||
"reference": { | ||
"Literal": { | ||
"table_name": "Post", | ||
"column_name": "id" | ||
} | ||
} | ||
}, | ||
{ | ||
"name": "has", | ||
"sqltype": { | ||
"KnownId": { | ||
"Ty": "Text" | ||
} | ||
}, | ||
"nullable": false, | ||
"pk": false, | ||
"auto": false, | ||
"unique": false, | ||
"default": null, | ||
"reference": { | ||
"Literal": { | ||
"table_name": "Tag", | ||
"column_name": "tag" | ||
} | ||
} | ||
} | ||
] | ||
} |
18 changes: 18 additions & 0 deletions
18
examples/getting_started/.butane/migrations/20240115_023841384_dbconstraints/Tag.table
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"name": "Tag", | ||
"columns": [ | ||
{ | ||
"name": "tag", | ||
"sqltype": { | ||
"KnownId": { | ||
"Ty": "Text" | ||
} | ||
}, | ||
"nullable": false, | ||
"pk": true, | ||
"auto": false, | ||
"unique": false, | ||
"default": null | ||
} | ||
] | ||
} |
6 changes: 6 additions & 0 deletions
6
examples/getting_started/.butane/migrations/20240115_023841384_dbconstraints/info.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"from_name": "20201229_171630604_likes", | ||
"backends": [ | ||
"sqlite" | ||
] | ||
} |
Empty file.
119 changes: 119 additions & 0 deletions
119
examples/getting_started/.butane/migrations/20240115_023841384_dbconstraints/sqlite_down.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
CREATE TABLE Blog__butane_tmp ( | ||
id INTEGER NOT NULL PRIMARY KEY, | ||
"name" TEXT NOT NULL | ||
); | ||
INSERT INTO Blog__butane_tmp SELECT id, "name" FROM Blog; | ||
DROP TABLE Blog; | ||
ALTER TABLE Blog__butane_tmp RENAME TO Blog; | ||
CREATE TABLE Blog__butane_tmp ( | ||
id INTEGER NOT NULL PRIMARY KEY, | ||
"name" TEXT NOT NULL | ||
); | ||
INSERT INTO Blog__butane_tmp SELECT id, "name" FROM Blog; | ||
DROP TABLE Blog; | ||
ALTER TABLE Blog__butane_tmp RENAME TO Blog; | ||
CREATE TABLE Post__butane_tmp ( | ||
id INTEGER NOT NULL PRIMARY KEY, | ||
title TEXT NOT NULL, | ||
body TEXT NOT NULL, | ||
published INTEGER NOT NULL, | ||
blog INTEGER NOT NULL, | ||
byline TEXT , | ||
likes INTEGER NOT NULL | ||
); | ||
INSERT INTO Post__butane_tmp SELECT id, title, body, published, blog, byline, likes FROM Post; | ||
DROP TABLE Post; | ||
ALTER TABLE Post__butane_tmp RENAME TO Post; | ||
CREATE TABLE Post__butane_tmp ( | ||
id INTEGER NOT NULL PRIMARY KEY, | ||
title TEXT NOT NULL, | ||
body TEXT NOT NULL, | ||
published INTEGER NOT NULL, | ||
blog INTEGER NOT NULL, | ||
byline TEXT , | ||
likes INTEGER NOT NULL | ||
); | ||
INSERT INTO Post__butane_tmp SELECT id, title, body, published, blog, byline, likes FROM Post; | ||
DROP TABLE Post; | ||
ALTER TABLE Post__butane_tmp RENAME TO Post; | ||
CREATE TABLE Post__butane_tmp ( | ||
id INTEGER NOT NULL PRIMARY KEY, | ||
title TEXT NOT NULL, | ||
body TEXT NOT NULL, | ||
published INTEGER NOT NULL, | ||
blog INTEGER NOT NULL, | ||
byline TEXT , | ||
likes INTEGER NOT NULL | ||
); | ||
INSERT INTO Post__butane_tmp SELECT id, title, body, published, blog, byline, likes FROM Post; | ||
DROP TABLE Post; | ||
ALTER TABLE Post__butane_tmp RENAME TO Post; | ||
CREATE TABLE Post__butane_tmp ( | ||
id INTEGER NOT NULL PRIMARY KEY, | ||
title TEXT NOT NULL, | ||
body TEXT NOT NULL, | ||
published INTEGER NOT NULL, | ||
blog INTEGER NOT NULL, | ||
byline TEXT , | ||
likes INTEGER NOT NULL | ||
); | ||
INSERT INTO Post__butane_tmp SELECT id, title, body, published, blog, byline, likes FROM Post; | ||
DROP TABLE Post; | ||
ALTER TABLE Post__butane_tmp RENAME TO Post; | ||
CREATE TABLE Post__butane_tmp ( | ||
id INTEGER NOT NULL PRIMARY KEY, | ||
title TEXT NOT NULL, | ||
body TEXT NOT NULL, | ||
published INTEGER NOT NULL, | ||
blog INTEGER NOT NULL, | ||
byline TEXT , | ||
likes INTEGER NOT NULL | ||
); | ||
INSERT INTO Post__butane_tmp SELECT id, title, body, published, blog, byline, likes FROM Post; | ||
DROP TABLE Post; | ||
ALTER TABLE Post__butane_tmp RENAME TO Post; | ||
CREATE TABLE Post__butane_tmp ( | ||
id INTEGER NOT NULL PRIMARY KEY, | ||
title TEXT NOT NULL, | ||
body TEXT NOT NULL, | ||
published INTEGER NOT NULL, | ||
blog INTEGER NOT NULL, | ||
byline TEXT , | ||
likes INTEGER NOT NULL | ||
); | ||
INSERT INTO Post__butane_tmp SELECT id, title, body, published, blog, byline, likes FROM Post; | ||
DROP TABLE Post; | ||
ALTER TABLE Post__butane_tmp RENAME TO Post; | ||
CREATE TABLE Post__butane_tmp ( | ||
id INTEGER NOT NULL PRIMARY KEY, | ||
title TEXT NOT NULL, | ||
body TEXT NOT NULL, | ||
published INTEGER NOT NULL, | ||
blog INTEGER NOT NULL, | ||
byline TEXT , | ||
likes INTEGER NOT NULL | ||
); | ||
INSERT INTO Post__butane_tmp SELECT id, title, body, published, blog, byline, likes FROM Post; | ||
DROP TABLE Post; | ||
ALTER TABLE Post__butane_tmp RENAME TO Post; | ||
CREATE TABLE Post_tags_Many__butane_tmp ( | ||
owner INTEGER NOT NULL, | ||
has TEXT NOT NULL, | ||
FOREIGN KEY (owner) REFERENCES Post(id) | ||
); | ||
INSERT INTO Post_tags_Many__butane_tmp SELECT owner, has FROM Post_tags_Many; | ||
DROP TABLE Post_tags_Many; | ||
ALTER TABLE Post_tags_Many__butane_tmp RENAME TO Post_tags_Many; | ||
CREATE TABLE Post_tags_Many__butane_tmp ( | ||
owner INTEGER NOT NULL, | ||
has TEXT NOT NULL | ||
); | ||
INSERT INTO Post_tags_Many__butane_tmp SELECT owner, has FROM Post_tags_Many; | ||
DROP TABLE Post_tags_Many; | ||
ALTER TABLE Post_tags_Many__butane_tmp RENAME TO Post_tags_Many; | ||
CREATE TABLE Tag__butane_tmp ( | ||
tag TEXT NOT NULL PRIMARY KEY | ||
); | ||
INSERT INTO Tag__butane_tmp SELECT tag FROM Tag; | ||
DROP TABLE Tag; | ||
ALTER TABLE Tag__butane_tmp RENAME TO Tag; |
Oops, something went wrong.