Browse Source

add sqlite migrations

we move our PostgreSQL specific migrations to a subdirectory.
The SQLite migrations have been created by running `diesel` against a
copy, and then fixing what's broken.
In the end i reduced all modifications to a single create, since we
*are* starting out fresh with SQLite.

n.b.: i'm not entirely happy with the results yet, because diesel
heavily modifies our `plume-models/src/schema.rs`.
I'll keep fiddling until we have the same types between the two
databases.
pull/226/head
Igor Galić 3 years ago
parent
commit
1f8680c4c5
Signed by: igalic GPG Key ID: ACFEFF7F6A123A86
  1. 1
      .gitignore
  2. 5
      diesel.toml
  3. 0
      migrations/postgres/00000000000000_diesel_initial_setup/down.sql
  4. 0
      migrations/postgres/00000000000000_diesel_initial_setup/up.sql
  5. 0
      migrations/postgres/2018-04-22-093322_create_instances/down.sql
  6. 0
      migrations/postgres/2018-04-22-093322_create_instances/up.sql
  7. 0
      migrations/postgres/2018-04-22-151330_create_user/down.sql
  8. 0
      migrations/postgres/2018-04-22-151330_create_user/up.sql
  9. 0
      migrations/postgres/2018-04-23-101717_create_blogs/down.sql
  10. 0
      migrations/postgres/2018-04-23-101717_create_blogs/up.sql
  11. 0
      migrations/postgres/2018-04-23-111655_create_blog_authors/down.sql
  12. 0
      migrations/postgres/2018-04-23-111655_create_blog_authors/up.sql
  13. 0
      migrations/postgres/2018-04-23-132822_create_posts/down.sql
  14. 0
      migrations/postgres/2018-04-23-132822_create_posts/up.sql
  15. 0
      migrations/postgres/2018-04-23-142746_create_post_authors/down.sql
  16. 0
      migrations/postgres/2018-04-23-142746_create_post_authors/up.sql
  17. 0
      migrations/postgres/2018-04-30-170445_timestamps/down.sql
  18. 0
      migrations/postgres/2018-04-30-170445_timestamps/up.sql
  19. 0
      migrations/postgres/2018-05-01-124607_create_follow/down.sql
  20. 0
      migrations/postgres/2018-05-01-124607_create_follow/up.sql
  21. 0
      migrations/postgres/2018-05-01-165325_add_ap_url/down.sql
  22. 0
      migrations/postgres/2018-05-01-165325_add_ap_url/up.sql
  23. 0
      migrations/postgres/2018-05-02-113930_drop_instance_local_domain/down.sql
  24. 0
      migrations/postgres/2018-05-02-113930_drop_instance_local_domain/up.sql
  25. 0
      migrations/postgres/2018-05-03-163427_user_add_keys/down.sql
  26. 0
      migrations/postgres/2018-05-03-163427_user_add_keys/up.sql
  27. 0
      migrations/postgres/2018-05-03-182555_blogs_add_keys/down.sql
  28. 0
      migrations/postgres/2018-05-03-182555_blogs_add_keys/up.sql
  29. 0
      migrations/postgres/2018-05-09-192013_create_comments/down.sql
  30. 0
      migrations/postgres/2018-05-09-192013_create_comments/up.sql
  31. 0
      migrations/postgres/2018-05-10-101553_posts_add_ap_url/down.sql
  32. 0
      migrations/postgres/2018-05-10-101553_posts_add_ap_url/up.sql
  33. 0
      migrations/postgres/2018-05-10-154336_create_likes/down.sql
  34. 0
      migrations/postgres/2018-05-10-154336_create_likes/up.sql
  35. 0
      migrations/postgres/2018-05-12-213456_likes_add_ap_url/down.sql
  36. 0
      migrations/postgres/2018-05-12-213456_likes_add_ap_url/up.sql
  37. 0
      migrations/postgres/2018-05-13-122311_create_notifications/down.sql
  38. 0
      migrations/postgres/2018-05-13-122311_create_notifications/up.sql
  39. 0
      migrations/postgres/2018-05-13-175144_users_add_shared_inbox/down.sql
  40. 0
      migrations/postgres/2018-05-13-175144_users_add_shared_inbox/up.sql
  41. 0
      migrations/postgres/2018-05-19-091428_create_reshares/down.sql
  42. 0
      migrations/postgres/2018-05-19-091428_create_reshares/up.sql
  43. 0
      migrations/postgres/2018-05-24-100613_add_notifications_creation_date/down.sql
  44. 0
      migrations/postgres/2018-05-24-100613_add_notifications_creation_date/up.sql
  45. 0
      migrations/postgres/2018-06-17-200302_notification_add_data/down.sql
  46. 0
      migrations/postgres/2018-06-17-200302_notification_add_data/up.sql
  47. 0
      migrations/postgres/2018-06-20-175532_create_mentions/down.sql
  48. 0
      migrations/postgres/2018-06-20-175532_create_mentions/up.sql
  49. 0
      migrations/postgres/2018-06-20-194538_add_mentions_ap_url/down.sql
  50. 0
      migrations/postgres/2018-06-20-194538_add_mentions_ap_url/up.sql
  51. 0
      migrations/postgres/2018-07-25-165754_refactor_notifications/down.sql
  52. 0
      migrations/postgres/2018-07-25-165754_refactor_notifications/up.sql
  53. 0
      migrations/postgres/2018-07-27-102221_user_add_followers_endpoint/down.sql
  54. 0
      migrations/postgres/2018-07-27-102221_user_add_followers_endpoint/up.sql
  55. 0
      migrations/postgres/2018-07-27-125558_instance_customization/down.sql
  56. 0
      migrations/postgres/2018-07-27-125558_instance_customization/up.sql
  57. 0
      migrations/postgres/2018-07-27-194816_instance_description_html/down.sql
  58. 0
      migrations/postgres/2018-07-27-194816_instance_description_html/up.sql
  59. 0
      migrations/postgres/2018-09-02-111458_create_medias/down.sql
  60. 0
      migrations/postgres/2018-09-02-111458_create_medias/up.sql
  61. 0
      migrations/postgres/2018-09-02-123623_medias_owner_id/down.sql
  62. 0
      migrations/postgres/2018-09-02-123623_medias_owner_id/up.sql
  63. 0
      migrations/postgres/2018-09-03-102510_users_add_avatar/down.sql
  64. 0
      migrations/postgres/2018-09-03-102510_users_add_avatar/up.sql
  65. 0
      migrations/postgres/2018-09-03-170848_user_add_last_fetched_date/down.sql
  66. 0
      migrations/postgres/2018-09-03-170848_user_add_last_fetched_date/up.sql
  67. 0
      migrations/postgres/2018-09-04-103017_follows_add_ap_url/down.sql
  68. 0
      migrations/postgres/2018-09-04-103017_follows_add_ap_url/up.sql
  69. 0
      migrations/postgres/2018-09-04-104828_posts_add_subtitle/down.sql
  70. 0
      migrations/postgres/2018-09-04-104828_posts_add_subtitle/up.sql
  71. 0
      migrations/postgres/2018-09-05-174106_create_tags/down.sql
  72. 0
      migrations/postgres/2018-09-05-174106_create_tags/up.sql
  73. 0
      migrations/postgres/2018-09-06-182637_posts_add_source/down.sql
  74. 0
      migrations/postgres/2018-09-06-182637_posts_add_source/up.sql
  75. 0
      migrations/postgres/2018-09-07-212003_fix_avatar_deletion/down.sql
  76. 0
      migrations/postgres/2018-09-07-212003_fix_avatar_deletion/up.sql
  77. 2
      migrations/sqlite/2018-04-22-093322_create_instances/down.sql
  78. 15
      migrations/sqlite/2018-04-22-093322_create_instances/up.sql
  79. 2
      migrations/sqlite/2018-04-22-151330_create_user/down.sql
  80. 23
      migrations/sqlite/2018-04-22-151330_create_user/up.sql
  81. 2
      migrations/sqlite/2018-04-23-101717_create_blogs/down.sql
  82. 14
      migrations/sqlite/2018-04-23-101717_create_blogs/up.sql
  83. 2
      migrations/sqlite/2018-04-23-111655_create_blog_authors/down.sql
  84. 7
      migrations/sqlite/2018-04-23-111655_create_blog_authors/up.sql
  85. 2
      migrations/sqlite/2018-04-23-132822_create_posts/down.sql
  86. 14
      migrations/sqlite/2018-04-23-132822_create_posts/up.sql
  87. 2
      migrations/sqlite/2018-04-23-142746_create_post_authors/down.sql
  88. 6
      migrations/sqlite/2018-04-23-142746_create_post_authors/up.sql
  89. 2
      migrations/sqlite/2018-05-01-124607_create_follow/down.sql
  90. 7
      migrations/sqlite/2018-05-01-124607_create_follow/up.sql
  91. 2
      migrations/sqlite/2018-05-09-192013_create_comments/down.sql
  92. 12
      migrations/sqlite/2018-05-09-192013_create_comments/up.sql
  93. 2
      migrations/sqlite/2018-05-10-154336_create_likes/down.sql
  94. 8
      migrations/sqlite/2018-05-10-154336_create_likes/up.sql
  95. 2
      migrations/sqlite/2018-05-13-122311_create_notifications/down.sql
  96. 8
      migrations/sqlite/2018-05-13-122311_create_notifications/up.sql
  97. 2
      migrations/sqlite/2018-05-19-091428_create_reshares/down.sql
  98. 8
      migrations/sqlite/2018-05-19-091428_create_reshares/up.sql
  99. 2
      migrations/sqlite/2018-06-20-175532_create_mentions/down.sql
  100. 8
      migrations/sqlite/2018-06-20-175532_create_mentions/up.sql

1
.gitignore

@ -9,3 +9,4 @@ po/*.po~
Rocket.toml
media
docker-compose.yml
*.db

5
diesel.toml

@ -0,0 +1,5 @@
# For documentation on how to configure this file,
# see diesel.rs/guides/configuring-diesel-cli
[print_schema]
file = "plume-models/src/schema.rs"

0
migrations/00000000000000_diesel_initial_setup/down.sql → migrations/postgres/00000000000000_diesel_initial_setup/down.sql

0
migrations/00000000000000_diesel_initial_setup/up.sql → migrations/postgres/00000000000000_diesel_initial_setup/up.sql

0
migrations/2018-04-22-093322_create_instances/down.sql → migrations/postgres/2018-04-22-093322_create_instances/down.sql

0
migrations/2018-04-22-093322_create_instances/up.sql → migrations/postgres/2018-04-22-093322_create_instances/up.sql

0
migrations/2018-04-22-151330_create_user/down.sql → migrations/postgres/2018-04-22-151330_create_user/down.sql

0
migrations/2018-04-22-151330_create_user/up.sql → migrations/postgres/2018-04-22-151330_create_user/up.sql

0
migrations/2018-04-23-101717_create_blogs/down.sql → migrations/postgres/2018-04-23-101717_create_blogs/down.sql

0
migrations/2018-04-23-101717_create_blogs/up.sql → migrations/postgres/2018-04-23-101717_create_blogs/up.sql

0
migrations/2018-04-23-111655_create_blog_authors/down.sql → migrations/postgres/2018-04-23-111655_create_blog_authors/down.sql

0
migrations/2018-04-23-111655_create_blog_authors/up.sql → migrations/postgres/2018-04-23-111655_create_blog_authors/up.sql

0
migrations/2018-04-23-132822_create_posts/down.sql → migrations/postgres/2018-04-23-132822_create_posts/down.sql

0
migrations/2018-04-23-132822_create_posts/up.sql → migrations/postgres/2018-04-23-132822_create_posts/up.sql

0
migrations/2018-04-23-142746_create_post_authors/down.sql → migrations/postgres/2018-04-23-142746_create_post_authors/down.sql

0
migrations/2018-04-23-142746_create_post_authors/up.sql → migrations/postgres/2018-04-23-142746_create_post_authors/up.sql

0
migrations/2018-04-30-170445_timestamps/down.sql → migrations/postgres/2018-04-30-170445_timestamps/down.sql

0
migrations/2018-04-30-170445_timestamps/up.sql → migrations/postgres/2018-04-30-170445_timestamps/up.sql

0
migrations/2018-05-01-124607_create_follow/down.sql → migrations/postgres/2018-05-01-124607_create_follow/down.sql

0
migrations/2018-05-01-124607_create_follow/up.sql → migrations/postgres/2018-05-01-124607_create_follow/up.sql

0
migrations/2018-05-01-165325_add_ap_url/down.sql → migrations/postgres/2018-05-01-165325_add_ap_url/down.sql

0
migrations/2018-05-01-165325_add_ap_url/up.sql → migrations/postgres/2018-05-01-165325_add_ap_url/up.sql

0
migrations/2018-05-02-113930_drop_instance_local_domain/down.sql → migrations/postgres/2018-05-02-113930_drop_instance_local_domain/down.sql

0
migrations/2018-05-02-113930_drop_instance_local_domain/up.sql → migrations/postgres/2018-05-02-113930_drop_instance_local_domain/up.sql

0
migrations/2018-05-03-163427_user_add_keys/down.sql → migrations/postgres/2018-05-03-163427_user_add_keys/down.sql

0
migrations/2018-05-03-163427_user_add_keys/up.sql → migrations/postgres/2018-05-03-163427_user_add_keys/up.sql

0
migrations/2018-05-03-182555_blogs_add_keys/down.sql → migrations/postgres/2018-05-03-182555_blogs_add_keys/down.sql

0
migrations/2018-05-03-182555_blogs_add_keys/up.sql → migrations/postgres/2018-05-03-182555_blogs_add_keys/up.sql

0
migrations/2018-05-09-192013_create_comments/down.sql → migrations/postgres/2018-05-09-192013_create_comments/down.sql

0
migrations/2018-05-09-192013_create_comments/up.sql → migrations/postgres/2018-05-09-192013_create_comments/up.sql

0
migrations/2018-05-10-101553_posts_add_ap_url/down.sql → migrations/postgres/2018-05-10-101553_posts_add_ap_url/down.sql

0
migrations/2018-05-10-101553_posts_add_ap_url/up.sql → migrations/postgres/2018-05-10-101553_posts_add_ap_url/up.sql

0
migrations/2018-05-10-154336_create_likes/down.sql → migrations/postgres/2018-05-10-154336_create_likes/down.sql

0
migrations/2018-05-10-154336_create_likes/up.sql → migrations/postgres/2018-05-10-154336_create_likes/up.sql

0
migrations/2018-05-12-213456_likes_add_ap_url/down.sql → migrations/postgres/2018-05-12-213456_likes_add_ap_url/down.sql

0
migrations/2018-05-12-213456_likes_add_ap_url/up.sql → migrations/postgres/2018-05-12-213456_likes_add_ap_url/up.sql

0
migrations/2018-05-13-122311_create_notifications/down.sql → migrations/postgres/2018-05-13-122311_create_notifications/down.sql

0
migrations/2018-05-13-122311_create_notifications/up.sql → migrations/postgres/2018-05-13-122311_create_notifications/up.sql

0
migrations/2018-05-13-175144_users_add_shared_inbox/down.sql → migrations/postgres/2018-05-13-175144_users_add_shared_inbox/down.sql

0
migrations/2018-05-13-175144_users_add_shared_inbox/up.sql → migrations/postgres/2018-05-13-175144_users_add_shared_inbox/up.sql

0
migrations/2018-05-19-091428_create_reshares/down.sql → migrations/postgres/2018-05-19-091428_create_reshares/down.sql

0
migrations/2018-05-19-091428_create_reshares/up.sql → migrations/postgres/2018-05-19-091428_create_reshares/up.sql

0
migrations/2018-05-24-100613_add_notifications_creation_date/down.sql → migrations/postgres/2018-05-24-100613_add_notifications_creation_date/down.sql

0
migrations/2018-05-24-100613_add_notifications_creation_date/up.sql → migrations/postgres/2018-05-24-100613_add_notifications_creation_date/up.sql

0
migrations/2018-06-17-200302_notification_add_data/down.sql → migrations/postgres/2018-06-17-200302_notification_add_data/down.sql

0
migrations/2018-06-17-200302_notification_add_data/up.sql → migrations/postgres/2018-06-17-200302_notification_add_data/up.sql

0
migrations/2018-06-20-175532_create_mentions/down.sql → migrations/postgres/2018-06-20-175532_create_mentions/down.sql

0
migrations/2018-06-20-175532_create_mentions/up.sql → migrations/postgres/2018-06-20-175532_create_mentions/up.sql

0
migrations/2018-06-20-194538_add_mentions_ap_url/down.sql → migrations/postgres/2018-06-20-194538_add_mentions_ap_url/down.sql

0
migrations/2018-06-20-194538_add_mentions_ap_url/up.sql → migrations/postgres/2018-06-20-194538_add_mentions_ap_url/up.sql

0
migrations/2018-07-25-165754_refactor_notifications/down.sql → migrations/postgres/2018-07-25-165754_refactor_notifications/down.sql

0
migrations/2018-07-25-165754_refactor_notifications/up.sql → migrations/postgres/2018-07-25-165754_refactor_notifications/up.sql

0
migrations/2018-07-27-102221_user_add_followers_endpoint/down.sql → migrations/postgres/2018-07-27-102221_user_add_followers_endpoint/down.sql

0
migrations/2018-07-27-102221_user_add_followers_endpoint/up.sql → migrations/postgres/2018-07-27-102221_user_add_followers_endpoint/up.sql

0
migrations/2018-07-27-125558_instance_customization/down.sql → migrations/postgres/2018-07-27-125558_instance_customization/down.sql

0
migrations/2018-07-27-125558_instance_customization/up.sql → migrations/postgres/2018-07-27-125558_instance_customization/up.sql

0
migrations/2018-07-27-194816_instance_description_html/down.sql → migrations/postgres/2018-07-27-194816_instance_description_html/down.sql

0
migrations/2018-07-27-194816_instance_description_html/up.sql → migrations/postgres/2018-07-27-194816_instance_description_html/up.sql

0
migrations/2018-09-02-111458_create_medias/down.sql → migrations/postgres/2018-09-02-111458_create_medias/down.sql

0
migrations/2018-09-02-111458_create_medias/up.sql → migrations/postgres/2018-09-02-111458_create_medias/up.sql

0
migrations/2018-09-02-123623_medias_owner_id/down.sql → migrations/postgres/2018-09-02-123623_medias_owner_id/down.sql

0
migrations/2018-09-02-123623_medias_owner_id/up.sql → migrations/postgres/2018-09-02-123623_medias_owner_id/up.sql

0
migrations/2018-09-03-102510_users_add_avatar/down.sql → migrations/postgres/2018-09-03-102510_users_add_avatar/down.sql

0
migrations/2018-09-03-102510_users_add_avatar/up.sql → migrations/postgres/2018-09-03-102510_users_add_avatar/up.sql

0
migrations/2018-09-03-170848_user_add_last_fetched_date/down.sql → migrations/postgres/2018-09-03-170848_user_add_last_fetched_date/down.sql

0
migrations/2018-09-03-170848_user_add_last_fetched_date/up.sql → migrations/postgres/2018-09-03-170848_user_add_last_fetched_date/up.sql

0
migrations/2018-09-04-103017_follows_add_ap_url/down.sql → migrations/postgres/2018-09-04-103017_follows_add_ap_url/down.sql

0
migrations/2018-09-04-103017_follows_add_ap_url/up.sql → migrations/postgres/2018-09-04-103017_follows_add_ap_url/up.sql

0
migrations/2018-09-04-104828_posts_add_subtitle/down.sql → migrations/postgres/2018-09-04-104828_posts_add_subtitle/down.sql

0
migrations/2018-09-04-104828_posts_add_subtitle/up.sql → migrations/postgres/2018-09-04-104828_posts_add_subtitle/up.sql

0
migrations/2018-09-05-174106_create_tags/down.sql → migrations/postgres/2018-09-05-174106_create_tags/down.sql

0
migrations/2018-09-05-174106_create_tags/up.sql → migrations/postgres/2018-09-05-174106_create_tags/up.sql

0
migrations/2018-09-06-182637_posts_add_source/down.sql → migrations/postgres/2018-09-06-182637_posts_add_source/down.sql

0
migrations/2018-09-06-182637_posts_add_source/up.sql → migrations/postgres/2018-09-06-182637_posts_add_source/up.sql

0
migrations/2018-09-07-212003_fix_avatar_deletion/down.sql → migrations/postgres/2018-09-07-212003_fix_avatar_deletion/down.sql

0
migrations/2018-09-07-212003_fix_avatar_deletion/up.sql → migrations/postgres/2018-09-07-212003_fix_avatar_deletion/up.sql

2
migrations/sqlite/2018-04-22-093322_create_instances/down.sql

@ -0,0 +1,2 @@
-- This file should undo anything in `up.sql`
DROP TABLE instances;

15
migrations/sqlite/2018-04-22-093322_create_instances/up.sql

@ -0,0 +1,15 @@
-- Your SQL goes here
CREATE TABLE instances (
id INTEGER PRIMARY KEY AUTOINCREMENT,
public_domain VARCHAR NOT NULL,
name VARCHAR NOT NULL,
local BOOLEAN NOT NULL DEFAULT 'f',
blocked BOOLEAN NOT NULL DEFAULT 'f',
creation_date INTEGER NOT NULL DEFAULT CURRENT_TIMESTAMP,
open_registrations BOOLEAN NOT NULL DEFAULT 't',
short_description TEXT NOT NULL DEFAULT '',
long_description TEXT NOT NULL DEFAULT '',
default_license TEXT NOT NULL DEFAULT 'CC-0',
long_description_html VARCHAR NOT NULL DEFAULT '',
short_description_html VARCHAR NOT NULL DEFAULT ''
)

2
migrations/sqlite/2018-04-22-151330_create_user/down.sql

@ -0,0 +1,2 @@
-- This file should undo anything in `up.sql`
DROP TABLE users;

23
migrations/sqlite/2018-04-22-151330_create_user/up.sql

@ -0,0 +1,23 @@
-- Your SQL goes here
PRAGMA foreign_keys = ON;
CREATE TABLE users (
id INTEGER PRIMARY KEY AUTOINCREMENT,
username VARCHAR NOT NULL,
display_name VARCHAR NOT NULL DEFAULT '',
outbox_url VARCHAR NOT NULL,
inbox_url VARCHAR NOT NULL,
is_admin BOOLEAN NOT NULL DEFAULT 'f',
summary TEXT NOT NULL DEFAULT '',
email TEXT,
hashed_password TEXT,
instance_id INTEGER REFERENCES instances(id) ON DELETE CASCADE NOT NULL,
creation_date INTEGER NOT NULL DEFAULT CURRENT_TIMESTAMP,
ap_url TEXT NOT NULL default '',
private_key TEXT,
public_key TEXT NOT NULL DEFAULT '',
shared_inbox_url VARCHAR,
followers_endpoint VARCHAR NOT NULL DEFAULT '',
avatar_id INTEGER REFERENCES medias(id) ON DELETE CASCADE,
last_fetched_date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (avatar_id) REFERENCES medias(id) ON DELETE SET NULL
);

2
migrations/sqlite/2018-04-23-101717_create_blogs/down.sql

@ -0,0 +1,2 @@
-- This file should undo anything in `up.sql`
DROP TABLE blogs;

14
migrations/sqlite/2018-04-23-101717_create_blogs/up.sql

@ -0,0 +1,14 @@
-- Your SQL goes here
CREATE TABLE blogs (
id INTEGER PRIMARY KEY AUTOINCREMENT,
actor_id VARCHAR NOT NULL,
title VARCHAR NOT NULL,
summary TEXT NOT NULL DEFAULT '',
outbox_url VARCHAR NOT NULL,
inbox_url VARCHAR NOT NULL,
instance_id INTEGER REFERENCES instances(id) ON DELETE CASCADE NOT NULL,
creation_date INTEGER NOT NULL DEFAULT CURRENT_TIMESTAMP,
ap_url text not null default '',
private_key TEXT,
public_key TEXT NOT NULL DEFAULT ''
)

2
migrations/sqlite/2018-04-23-111655_create_blog_authors/down.sql

@ -0,0 +1,2 @@
-- This file should undo anything in `up.sql`
DROP TABLE blog_authors;

7
migrations/sqlite/2018-04-23-111655_create_blog_authors/up.sql

@ -0,0 +1,7 @@
-- Your SQL goes here
CREATE TABLE blog_authors (
id INTEGER PRIMARY KEY AUTOINCREMENT,
blog_id INTEGER REFERENCES blogs(id) ON DELETE CASCADE NOT NULL,
author_id INTEGER REFERENCES users(id) ON DELETE CASCADE NOT NULL,
is_owner BOOLEAN NOT NULL DEFAULT 'f'
)

2
migrations/sqlite/2018-04-23-132822_create_posts/down.sql

@ -0,0 +1,2 @@
-- This file should undo anything in `up.sql`
DROP TABLE posts;

14
migrations/sqlite/2018-04-23-132822_create_posts/up.sql

@ -0,0 +1,14 @@
-- Your SQL goes here
CREATE TABLE posts (
id INTEGER PRIMARY KEY AUTOINCREMENT,
blog_id INTEGER REFERENCES blogs(id) ON DELETE CASCADE NOT NULL,
slug VARCHAR NOT NULL,
title VARCHAR NOT NULL,
content TEXT NOT NULL DEFAULT '',
published BOOLEAN NOT NULL DEFAULT 'f',
license VARCHAR NOT NULL DEFAULT 'CC-0',
creation_date INTEGER NOT NULL DEFAULT CURRENT_TIMESTAMP,
ap_url VARCHAR NOT NULL DEFAULT '',
subtitle TEXT NOT NULL DEFAULT '',
source TEXT NOT NULL DEFAULT ''
)

2
migrations/sqlite/2018-04-23-142746_create_post_authors/down.sql

@ -0,0 +1,2 @@
-- This file should undo anything in `up.sql`
DROP TABLE post_authors;

6
migrations/sqlite/2018-04-23-142746_create_post_authors/up.sql

@ -0,0 +1,6 @@
-- Your SQL goes here
CREATE TABLE post_authors (
id INTEGER PRIMARY KEY AUTOINCREMENT,
post_id INTEGER REFERENCES posts(id) ON DELETE CASCADE NOT NULL,
author_id INTEGER REFERENCES users(id) ON DELETE CASCADE NOT NULL
)

2
migrations/sqlite/2018-05-01-124607_create_follow/down.sql

@ -0,0 +1,2 @@
-- This file should undo anything in `up.sql`
DROP TABLE follows;

7
migrations/sqlite/2018-05-01-124607_create_follow/up.sql

@ -0,0 +1,7 @@
-- Your SQL goes here
CREATE TABLE follows (
id INTEGER PRIMARY KEY AUTOINCREMENT,
follower_id INTEGER REFERENCES users(id) ON DELETE CASCADE NOT NULL,
following_id INTEGER REFERENCES users(id) ON DELETE CASCADE NOT NULL,
ap_url TEXT NOT NULL default ''
)

2
migrations/sqlite/2018-05-09-192013_create_comments/down.sql

@ -0,0 +1,2 @@
-- This file should undo anything in `up.sql`
DROP TABLE comments;

12
migrations/sqlite/2018-05-09-192013_create_comments/up.sql

@ -0,0 +1,12 @@
-- Your SQL goes here
CREATE TABLE comments (
id INTEGER PRIMARY KEY AUTOINCREMENT,
content TEXT NOT NULL DEFAULT '',
in_response_to_id INTEGER REFERENCES comments(id),
post_id INTEGER REFERENCES posts(id) ON DELETE CASCADE NOT NULL,
author_id INTEGER REFERENCES users(id) ON DELETE CASCADE NOT NULL,
creation_date INTEGER NOT NULL DEFAULT CURRENT_TIMESTAMP,
ap_url VARCHAR,
sensitive BOOLEAN NOT NULL DEFAULT 'f',
spoiler_text TEXT NOT NULL DEFAULT ''
)

2
migrations/sqlite/2018-05-10-154336_create_likes/down.sql

@ -0,0 +1,2 @@
-- This file should undo anything in `up.sql`
DROP TABLE likes;

8
migrations/sqlite/2018-05-10-154336_create_likes/up.sql

@ -0,0 +1,8 @@
-- Your SQL goes here
CREATE TABLE likes (
id INTEGER PRIMARY KEY AUTOINCREMENT,
user_id INTEGER REFERENCES users(id) ON DELETE CASCADE NOT NULL,
post_id INTEGER REFERENCES posts(id) ON DELETE CASCADE NOT NULL,
ap_url VARCHAR NOT NULL default '',
creation_date INTEGER NOT NULL DEFAULT CURRENT_TIMESTAMP
)

2
migrations/sqlite/2018-05-13-122311_create_notifications/down.sql

@ -0,0 +1,2 @@
-- This file should undo anything in `up.sql`
DROP TABLE notifications;

8
migrations/sqlite/2018-05-13-122311_create_notifications/up.sql

@ -0,0 +1,8 @@
-- Your SQL goes here
CREATE TABLE notifications (
id INTEGER PRIMARY KEY AUTOINCREMENT,
user_id INTEGER REFERENCES users(id) ON DELETE CASCADE NOT NULL,
creation_date INTEGER NOT NULL DEFAULT CURRENT_TIMESTAMP,
kind VARCHAR NOT NULL DEFAULT 'unknown',
object_id INTEGER NOT NULL DEFAULT 0
)

2
migrations/sqlite/2018-05-19-091428_create_reshares/down.sql

@ -0,0 +1,2 @@
-- This file should undo anything in `up.sql`
DROP TABLE reshares;

8
migrations/sqlite/2018-05-19-091428_create_reshares/up.sql

@ -0,0 +1,8 @@
-- Your SQL goes here
CREATE TABLE reshares (
id INTEGER PRIMARY KEY AUTOINCREMENT,
user_id INTEGER REFERENCES users(id) ON DELETE CASCADE NOT NULL,
post_id INTEGER REFERENCES posts(id) ON DELETE CASCADE NOT NULL,
ap_url VARCHAR NOT NULL DEFAULT '',
creation_date INTEGER NOT NULL DEFAULT CURRENT_TIMESTAMP
)

2
migrations/sqlite/2018-06-20-175532_create_mentions/down.sql

@ -0,0 +1,2 @@
-- This file should undo anything in `up.sql`
DROP TABLE mentions;

8
migrations/sqlite/2018-06-20-175532_create_mentions/up.sql

@ -0,0 +1,8 @@
-- Your SQL goes here
CREATE TABLE mentions (
id INTEGER PRIMARY KEY AUTOINCREMENT,
mentioned_id INTEGER REFERENCES users(id) ON DELETE CASCADE NOT NULL,
post_id INTEGER REFERENCES posts(id) ON DELETE CASCADE,
comment_id INTEGER REFERENCES comments(id) ON DELETE CASCADE,
ap_url VARCHAR NOT NULL DEFAULT ''
)

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save