From 1f8680c4c57ba42e30630414fc1871e9cb35a3d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Igor=20Gali=C4=87?= Date: Sat, 15 Sep 2018 13:38:09 +0200 Subject: [PATCH] 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. --- .gitignore | 1 + diesel.toml | 5 + .../down.sql | 0 .../up.sql | 0 .../down.sql | 0 .../2018-04-22-093322_create_instances/up.sql | 0 .../2018-04-22-151330_create_user/down.sql | 0 .../2018-04-22-151330_create_user/up.sql | 0 .../2018-04-23-101717_create_blogs/down.sql | 0 .../2018-04-23-101717_create_blogs/up.sql | 0 .../down.sql | 0 .../up.sql | 0 .../2018-04-23-132822_create_posts/down.sql | 0 .../2018-04-23-132822_create_posts/up.sql | 0 .../down.sql | 0 .../up.sql | 0 .../2018-04-30-170445_timestamps/down.sql | 0 .../2018-04-30-170445_timestamps/up.sql | 0 .../2018-05-01-124607_create_follow/down.sql | 0 .../2018-05-01-124607_create_follow/up.sql | 0 .../2018-05-01-165325_add_ap_url/down.sql | 0 .../2018-05-01-165325_add_ap_url/up.sql | 0 .../down.sql | 0 .../up.sql | 0 .../2018-05-03-163427_user_add_keys/down.sql | 0 .../2018-05-03-163427_user_add_keys/up.sql | 0 .../2018-05-03-182555_blogs_add_keys/down.sql | 0 .../2018-05-03-182555_blogs_add_keys/up.sql | 0 .../down.sql | 0 .../2018-05-09-192013_create_comments/up.sql | 0 .../down.sql | 0 .../2018-05-10-101553_posts_add_ap_url/up.sql | 0 .../2018-05-10-154336_create_likes/down.sql | 0 .../2018-05-10-154336_create_likes/up.sql | 0 .../down.sql | 0 .../2018-05-12-213456_likes_add_ap_url/up.sql | 0 .../down.sql | 0 .../up.sql | 0 .../down.sql | 0 .../up.sql | 0 .../down.sql | 0 .../2018-05-19-091428_create_reshares/up.sql | 0 .../down.sql | 0 .../up.sql | 0 .../down.sql | 0 .../up.sql | 0 .../down.sql | 0 .../2018-06-20-175532_create_mentions/up.sql | 0 .../down.sql | 0 .../up.sql | 0 .../down.sql | 0 .../up.sql | 0 .../down.sql | 0 .../up.sql | 0 .../down.sql | 0 .../up.sql | 0 .../down.sql | 0 .../up.sql | 0 .../2018-09-02-111458_create_medias/down.sql | 0 .../2018-09-02-111458_create_medias/up.sql | 0 .../down.sql | 0 .../2018-09-02-123623_medias_owner_id/up.sql | 0 .../down.sql | 0 .../2018-09-03-102510_users_add_avatar/up.sql | 0 .../down.sql | 0 .../up.sql | 0 .../down.sql | 0 .../up.sql | 0 .../down.sql | 0 .../up.sql | 0 .../2018-09-05-174106_create_tags/down.sql | 0 .../2018-09-05-174106_create_tags/up.sql | 0 .../down.sql | 0 .../2018-09-06-182637_posts_add_source/up.sql | 0 .../down.sql | 0 .../up.sql | 0 .../down.sql | 2 + .../2018-04-22-093322_create_instances/up.sql | 15 ++ .../2018-04-22-151330_create_user/down.sql | 2 + .../2018-04-22-151330_create_user/up.sql | 23 +++ .../2018-04-23-101717_create_blogs/down.sql | 2 + .../2018-04-23-101717_create_blogs/up.sql | 14 ++ .../down.sql | 2 + .../up.sql | 7 + .../2018-04-23-132822_create_posts/down.sql | 2 + .../2018-04-23-132822_create_posts/up.sql | 14 ++ .../down.sql | 2 + .../up.sql | 6 + .../2018-05-01-124607_create_follow/down.sql | 2 + .../2018-05-01-124607_create_follow/up.sql | 7 + .../down.sql | 2 + .../2018-05-09-192013_create_comments/up.sql | 12 ++ .../2018-05-10-154336_create_likes/down.sql | 2 + .../2018-05-10-154336_create_likes/up.sql | 8 + .../down.sql | 2 + .../up.sql | 8 + .../down.sql | 2 + .../2018-05-19-091428_create_reshares/up.sql | 8 + .../down.sql | 2 + .../2018-06-20-175532_create_mentions/up.sql | 8 + .../2018-09-02-111458_create_medias/down.sql | 2 + .../2018-09-02-111458_create_medias/up.sql | 11 ++ .../2018-09-05-174106_create_tags/down.sql | 2 + .../2018-09-05-174106_create_tags/up.sql | 7 + plume-models/src/schema.rs | 138 +++++++++--------- 105 files changed, 251 insertions(+), 69 deletions(-) create mode 100644 diesel.toml rename migrations/{ => postgres}/00000000000000_diesel_initial_setup/down.sql (100%) rename migrations/{ => postgres}/00000000000000_diesel_initial_setup/up.sql (100%) rename migrations/{ => postgres}/2018-04-22-093322_create_instances/down.sql (100%) rename migrations/{ => postgres}/2018-04-22-093322_create_instances/up.sql (100%) rename migrations/{ => postgres}/2018-04-22-151330_create_user/down.sql (100%) rename migrations/{ => postgres}/2018-04-22-151330_create_user/up.sql (100%) rename migrations/{ => postgres}/2018-04-23-101717_create_blogs/down.sql (100%) rename migrations/{ => postgres}/2018-04-23-101717_create_blogs/up.sql (100%) rename migrations/{ => postgres}/2018-04-23-111655_create_blog_authors/down.sql (100%) rename migrations/{ => postgres}/2018-04-23-111655_create_blog_authors/up.sql (100%) rename migrations/{ => postgres}/2018-04-23-132822_create_posts/down.sql (100%) rename migrations/{ => postgres}/2018-04-23-132822_create_posts/up.sql (100%) rename migrations/{ => postgres}/2018-04-23-142746_create_post_authors/down.sql (100%) rename migrations/{ => postgres}/2018-04-23-142746_create_post_authors/up.sql (100%) rename migrations/{ => postgres}/2018-04-30-170445_timestamps/down.sql (100%) rename migrations/{ => postgres}/2018-04-30-170445_timestamps/up.sql (100%) rename migrations/{ => postgres}/2018-05-01-124607_create_follow/down.sql (100%) rename migrations/{ => postgres}/2018-05-01-124607_create_follow/up.sql (100%) rename migrations/{ => postgres}/2018-05-01-165325_add_ap_url/down.sql (100%) rename migrations/{ => postgres}/2018-05-01-165325_add_ap_url/up.sql (100%) rename migrations/{ => postgres}/2018-05-02-113930_drop_instance_local_domain/down.sql (100%) rename migrations/{ => postgres}/2018-05-02-113930_drop_instance_local_domain/up.sql (100%) rename migrations/{ => postgres}/2018-05-03-163427_user_add_keys/down.sql (100%) rename migrations/{ => postgres}/2018-05-03-163427_user_add_keys/up.sql (100%) rename migrations/{ => postgres}/2018-05-03-182555_blogs_add_keys/down.sql (100%) rename migrations/{ => postgres}/2018-05-03-182555_blogs_add_keys/up.sql (100%) rename migrations/{ => postgres}/2018-05-09-192013_create_comments/down.sql (100%) rename migrations/{ => postgres}/2018-05-09-192013_create_comments/up.sql (100%) rename migrations/{ => postgres}/2018-05-10-101553_posts_add_ap_url/down.sql (100%) rename migrations/{ => postgres}/2018-05-10-101553_posts_add_ap_url/up.sql (100%) rename migrations/{ => postgres}/2018-05-10-154336_create_likes/down.sql (100%) rename migrations/{ => postgres}/2018-05-10-154336_create_likes/up.sql (100%) rename migrations/{ => postgres}/2018-05-12-213456_likes_add_ap_url/down.sql (100%) rename migrations/{ => postgres}/2018-05-12-213456_likes_add_ap_url/up.sql (100%) rename migrations/{ => postgres}/2018-05-13-122311_create_notifications/down.sql (100%) rename migrations/{ => postgres}/2018-05-13-122311_create_notifications/up.sql (100%) rename migrations/{ => postgres}/2018-05-13-175144_users_add_shared_inbox/down.sql (100%) rename migrations/{ => postgres}/2018-05-13-175144_users_add_shared_inbox/up.sql (100%) rename migrations/{ => postgres}/2018-05-19-091428_create_reshares/down.sql (100%) rename migrations/{ => postgres}/2018-05-19-091428_create_reshares/up.sql (100%) rename migrations/{ => postgres}/2018-05-24-100613_add_notifications_creation_date/down.sql (100%) rename migrations/{ => postgres}/2018-05-24-100613_add_notifications_creation_date/up.sql (100%) rename migrations/{ => postgres}/2018-06-17-200302_notification_add_data/down.sql (100%) rename migrations/{ => postgres}/2018-06-17-200302_notification_add_data/up.sql (100%) rename migrations/{ => postgres}/2018-06-20-175532_create_mentions/down.sql (100%) rename migrations/{ => postgres}/2018-06-20-175532_create_mentions/up.sql (100%) rename migrations/{ => postgres}/2018-06-20-194538_add_mentions_ap_url/down.sql (100%) rename migrations/{ => postgres}/2018-06-20-194538_add_mentions_ap_url/up.sql (100%) rename migrations/{ => postgres}/2018-07-25-165754_refactor_notifications/down.sql (100%) rename migrations/{ => postgres}/2018-07-25-165754_refactor_notifications/up.sql (100%) rename migrations/{ => postgres}/2018-07-27-102221_user_add_followers_endpoint/down.sql (100%) rename migrations/{ => postgres}/2018-07-27-102221_user_add_followers_endpoint/up.sql (100%) rename migrations/{ => postgres}/2018-07-27-125558_instance_customization/down.sql (100%) rename migrations/{ => postgres}/2018-07-27-125558_instance_customization/up.sql (100%) rename migrations/{ => postgres}/2018-07-27-194816_instance_description_html/down.sql (100%) rename migrations/{ => postgres}/2018-07-27-194816_instance_description_html/up.sql (100%) rename migrations/{ => postgres}/2018-09-02-111458_create_medias/down.sql (100%) rename migrations/{ => postgres}/2018-09-02-111458_create_medias/up.sql (100%) rename migrations/{ => postgres}/2018-09-02-123623_medias_owner_id/down.sql (100%) rename migrations/{ => postgres}/2018-09-02-123623_medias_owner_id/up.sql (100%) rename migrations/{ => postgres}/2018-09-03-102510_users_add_avatar/down.sql (100%) rename migrations/{ => postgres}/2018-09-03-102510_users_add_avatar/up.sql (100%) rename migrations/{ => postgres}/2018-09-03-170848_user_add_last_fetched_date/down.sql (100%) rename migrations/{ => postgres}/2018-09-03-170848_user_add_last_fetched_date/up.sql (100%) rename migrations/{ => postgres}/2018-09-04-103017_follows_add_ap_url/down.sql (100%) rename migrations/{ => postgres}/2018-09-04-103017_follows_add_ap_url/up.sql (100%) rename migrations/{ => postgres}/2018-09-04-104828_posts_add_subtitle/down.sql (100%) rename migrations/{ => postgres}/2018-09-04-104828_posts_add_subtitle/up.sql (100%) rename migrations/{ => postgres}/2018-09-05-174106_create_tags/down.sql (100%) rename migrations/{ => postgres}/2018-09-05-174106_create_tags/up.sql (100%) rename migrations/{ => postgres}/2018-09-06-182637_posts_add_source/down.sql (100%) rename migrations/{ => postgres}/2018-09-06-182637_posts_add_source/up.sql (100%) rename migrations/{ => postgres}/2018-09-07-212003_fix_avatar_deletion/down.sql (100%) rename migrations/{ => postgres}/2018-09-07-212003_fix_avatar_deletion/up.sql (100%) create mode 100644 migrations/sqlite/2018-04-22-093322_create_instances/down.sql create mode 100644 migrations/sqlite/2018-04-22-093322_create_instances/up.sql create mode 100644 migrations/sqlite/2018-04-22-151330_create_user/down.sql create mode 100644 migrations/sqlite/2018-04-22-151330_create_user/up.sql create mode 100644 migrations/sqlite/2018-04-23-101717_create_blogs/down.sql create mode 100644 migrations/sqlite/2018-04-23-101717_create_blogs/up.sql create mode 100644 migrations/sqlite/2018-04-23-111655_create_blog_authors/down.sql create mode 100644 migrations/sqlite/2018-04-23-111655_create_blog_authors/up.sql create mode 100644 migrations/sqlite/2018-04-23-132822_create_posts/down.sql create mode 100644 migrations/sqlite/2018-04-23-132822_create_posts/up.sql create mode 100644 migrations/sqlite/2018-04-23-142746_create_post_authors/down.sql create mode 100644 migrations/sqlite/2018-04-23-142746_create_post_authors/up.sql create mode 100644 migrations/sqlite/2018-05-01-124607_create_follow/down.sql create mode 100644 migrations/sqlite/2018-05-01-124607_create_follow/up.sql create mode 100644 migrations/sqlite/2018-05-09-192013_create_comments/down.sql create mode 100644 migrations/sqlite/2018-05-09-192013_create_comments/up.sql create mode 100644 migrations/sqlite/2018-05-10-154336_create_likes/down.sql create mode 100644 migrations/sqlite/2018-05-10-154336_create_likes/up.sql create mode 100644 migrations/sqlite/2018-05-13-122311_create_notifications/down.sql create mode 100644 migrations/sqlite/2018-05-13-122311_create_notifications/up.sql create mode 100644 migrations/sqlite/2018-05-19-091428_create_reshares/down.sql create mode 100644 migrations/sqlite/2018-05-19-091428_create_reshares/up.sql create mode 100644 migrations/sqlite/2018-06-20-175532_create_mentions/down.sql create mode 100644 migrations/sqlite/2018-06-20-175532_create_mentions/up.sql create mode 100644 migrations/sqlite/2018-09-02-111458_create_medias/down.sql create mode 100644 migrations/sqlite/2018-09-02-111458_create_medias/up.sql create mode 100644 migrations/sqlite/2018-09-05-174106_create_tags/down.sql create mode 100644 migrations/sqlite/2018-09-05-174106_create_tags/up.sql diff --git a/.gitignore b/.gitignore index 46d7c43..73543a9 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ po/*.po~ Rocket.toml media docker-compose.yml +*.db diff --git a/diesel.toml b/diesel.toml new file mode 100644 index 0000000..57dcc64 --- /dev/null +++ b/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" diff --git a/migrations/00000000000000_diesel_initial_setup/down.sql b/migrations/postgres/00000000000000_diesel_initial_setup/down.sql similarity index 100% rename from migrations/00000000000000_diesel_initial_setup/down.sql rename to migrations/postgres/00000000000000_diesel_initial_setup/down.sql diff --git a/migrations/00000000000000_diesel_initial_setup/up.sql b/migrations/postgres/00000000000000_diesel_initial_setup/up.sql similarity index 100% rename from migrations/00000000000000_diesel_initial_setup/up.sql rename to migrations/postgres/00000000000000_diesel_initial_setup/up.sql diff --git a/migrations/2018-04-22-093322_create_instances/down.sql b/migrations/postgres/2018-04-22-093322_create_instances/down.sql similarity index 100% rename from migrations/2018-04-22-093322_create_instances/down.sql rename to migrations/postgres/2018-04-22-093322_create_instances/down.sql diff --git a/migrations/2018-04-22-093322_create_instances/up.sql b/migrations/postgres/2018-04-22-093322_create_instances/up.sql similarity index 100% rename from migrations/2018-04-22-093322_create_instances/up.sql rename to migrations/postgres/2018-04-22-093322_create_instances/up.sql diff --git a/migrations/2018-04-22-151330_create_user/down.sql b/migrations/postgres/2018-04-22-151330_create_user/down.sql similarity index 100% rename from migrations/2018-04-22-151330_create_user/down.sql rename to migrations/postgres/2018-04-22-151330_create_user/down.sql diff --git a/migrations/2018-04-22-151330_create_user/up.sql b/migrations/postgres/2018-04-22-151330_create_user/up.sql similarity index 100% rename from migrations/2018-04-22-151330_create_user/up.sql rename to migrations/postgres/2018-04-22-151330_create_user/up.sql diff --git a/migrations/2018-04-23-101717_create_blogs/down.sql b/migrations/postgres/2018-04-23-101717_create_blogs/down.sql similarity index 100% rename from migrations/2018-04-23-101717_create_blogs/down.sql rename to migrations/postgres/2018-04-23-101717_create_blogs/down.sql diff --git a/migrations/2018-04-23-101717_create_blogs/up.sql b/migrations/postgres/2018-04-23-101717_create_blogs/up.sql similarity index 100% rename from migrations/2018-04-23-101717_create_blogs/up.sql rename to migrations/postgres/2018-04-23-101717_create_blogs/up.sql diff --git a/migrations/2018-04-23-111655_create_blog_authors/down.sql b/migrations/postgres/2018-04-23-111655_create_blog_authors/down.sql similarity index 100% rename from migrations/2018-04-23-111655_create_blog_authors/down.sql rename to migrations/postgres/2018-04-23-111655_create_blog_authors/down.sql diff --git a/migrations/2018-04-23-111655_create_blog_authors/up.sql b/migrations/postgres/2018-04-23-111655_create_blog_authors/up.sql similarity index 100% rename from migrations/2018-04-23-111655_create_blog_authors/up.sql rename to migrations/postgres/2018-04-23-111655_create_blog_authors/up.sql diff --git a/migrations/2018-04-23-132822_create_posts/down.sql b/migrations/postgres/2018-04-23-132822_create_posts/down.sql similarity index 100% rename from migrations/2018-04-23-132822_create_posts/down.sql rename to migrations/postgres/2018-04-23-132822_create_posts/down.sql diff --git a/migrations/2018-04-23-132822_create_posts/up.sql b/migrations/postgres/2018-04-23-132822_create_posts/up.sql similarity index 100% rename from migrations/2018-04-23-132822_create_posts/up.sql rename to migrations/postgres/2018-04-23-132822_create_posts/up.sql diff --git a/migrations/2018-04-23-142746_create_post_authors/down.sql b/migrations/postgres/2018-04-23-142746_create_post_authors/down.sql similarity index 100% rename from migrations/2018-04-23-142746_create_post_authors/down.sql rename to migrations/postgres/2018-04-23-142746_create_post_authors/down.sql diff --git a/migrations/2018-04-23-142746_create_post_authors/up.sql b/migrations/postgres/2018-04-23-142746_create_post_authors/up.sql similarity index 100% rename from migrations/2018-04-23-142746_create_post_authors/up.sql rename to migrations/postgres/2018-04-23-142746_create_post_authors/up.sql diff --git a/migrations/2018-04-30-170445_timestamps/down.sql b/migrations/postgres/2018-04-30-170445_timestamps/down.sql similarity index 100% rename from migrations/2018-04-30-170445_timestamps/down.sql rename to migrations/postgres/2018-04-30-170445_timestamps/down.sql diff --git a/migrations/2018-04-30-170445_timestamps/up.sql b/migrations/postgres/2018-04-30-170445_timestamps/up.sql similarity index 100% rename from migrations/2018-04-30-170445_timestamps/up.sql rename to migrations/postgres/2018-04-30-170445_timestamps/up.sql diff --git a/migrations/2018-05-01-124607_create_follow/down.sql b/migrations/postgres/2018-05-01-124607_create_follow/down.sql similarity index 100% rename from migrations/2018-05-01-124607_create_follow/down.sql rename to migrations/postgres/2018-05-01-124607_create_follow/down.sql diff --git a/migrations/2018-05-01-124607_create_follow/up.sql b/migrations/postgres/2018-05-01-124607_create_follow/up.sql similarity index 100% rename from migrations/2018-05-01-124607_create_follow/up.sql rename to migrations/postgres/2018-05-01-124607_create_follow/up.sql diff --git a/migrations/2018-05-01-165325_add_ap_url/down.sql b/migrations/postgres/2018-05-01-165325_add_ap_url/down.sql similarity index 100% rename from migrations/2018-05-01-165325_add_ap_url/down.sql rename to migrations/postgres/2018-05-01-165325_add_ap_url/down.sql diff --git a/migrations/2018-05-01-165325_add_ap_url/up.sql b/migrations/postgres/2018-05-01-165325_add_ap_url/up.sql similarity index 100% rename from migrations/2018-05-01-165325_add_ap_url/up.sql rename to migrations/postgres/2018-05-01-165325_add_ap_url/up.sql diff --git a/migrations/2018-05-02-113930_drop_instance_local_domain/down.sql b/migrations/postgres/2018-05-02-113930_drop_instance_local_domain/down.sql similarity index 100% rename from migrations/2018-05-02-113930_drop_instance_local_domain/down.sql rename to migrations/postgres/2018-05-02-113930_drop_instance_local_domain/down.sql diff --git a/migrations/2018-05-02-113930_drop_instance_local_domain/up.sql b/migrations/postgres/2018-05-02-113930_drop_instance_local_domain/up.sql similarity index 100% rename from migrations/2018-05-02-113930_drop_instance_local_domain/up.sql rename to migrations/postgres/2018-05-02-113930_drop_instance_local_domain/up.sql diff --git a/migrations/2018-05-03-163427_user_add_keys/down.sql b/migrations/postgres/2018-05-03-163427_user_add_keys/down.sql similarity index 100% rename from migrations/2018-05-03-163427_user_add_keys/down.sql rename to migrations/postgres/2018-05-03-163427_user_add_keys/down.sql diff --git a/migrations/2018-05-03-163427_user_add_keys/up.sql b/migrations/postgres/2018-05-03-163427_user_add_keys/up.sql similarity index 100% rename from migrations/2018-05-03-163427_user_add_keys/up.sql rename to migrations/postgres/2018-05-03-163427_user_add_keys/up.sql diff --git a/migrations/2018-05-03-182555_blogs_add_keys/down.sql b/migrations/postgres/2018-05-03-182555_blogs_add_keys/down.sql similarity index 100% rename from migrations/2018-05-03-182555_blogs_add_keys/down.sql rename to migrations/postgres/2018-05-03-182555_blogs_add_keys/down.sql diff --git a/migrations/2018-05-03-182555_blogs_add_keys/up.sql b/migrations/postgres/2018-05-03-182555_blogs_add_keys/up.sql similarity index 100% rename from migrations/2018-05-03-182555_blogs_add_keys/up.sql rename to migrations/postgres/2018-05-03-182555_blogs_add_keys/up.sql diff --git a/migrations/2018-05-09-192013_create_comments/down.sql b/migrations/postgres/2018-05-09-192013_create_comments/down.sql similarity index 100% rename from migrations/2018-05-09-192013_create_comments/down.sql rename to migrations/postgres/2018-05-09-192013_create_comments/down.sql diff --git a/migrations/2018-05-09-192013_create_comments/up.sql b/migrations/postgres/2018-05-09-192013_create_comments/up.sql similarity index 100% rename from migrations/2018-05-09-192013_create_comments/up.sql rename to migrations/postgres/2018-05-09-192013_create_comments/up.sql diff --git a/migrations/2018-05-10-101553_posts_add_ap_url/down.sql b/migrations/postgres/2018-05-10-101553_posts_add_ap_url/down.sql similarity index 100% rename from migrations/2018-05-10-101553_posts_add_ap_url/down.sql rename to migrations/postgres/2018-05-10-101553_posts_add_ap_url/down.sql diff --git a/migrations/2018-05-10-101553_posts_add_ap_url/up.sql b/migrations/postgres/2018-05-10-101553_posts_add_ap_url/up.sql similarity index 100% rename from migrations/2018-05-10-101553_posts_add_ap_url/up.sql rename to migrations/postgres/2018-05-10-101553_posts_add_ap_url/up.sql diff --git a/migrations/2018-05-10-154336_create_likes/down.sql b/migrations/postgres/2018-05-10-154336_create_likes/down.sql similarity index 100% rename from migrations/2018-05-10-154336_create_likes/down.sql rename to migrations/postgres/2018-05-10-154336_create_likes/down.sql diff --git a/migrations/2018-05-10-154336_create_likes/up.sql b/migrations/postgres/2018-05-10-154336_create_likes/up.sql similarity index 100% rename from migrations/2018-05-10-154336_create_likes/up.sql rename to migrations/postgres/2018-05-10-154336_create_likes/up.sql diff --git a/migrations/2018-05-12-213456_likes_add_ap_url/down.sql b/migrations/postgres/2018-05-12-213456_likes_add_ap_url/down.sql similarity index 100% rename from migrations/2018-05-12-213456_likes_add_ap_url/down.sql rename to migrations/postgres/2018-05-12-213456_likes_add_ap_url/down.sql diff --git a/migrations/2018-05-12-213456_likes_add_ap_url/up.sql b/migrations/postgres/2018-05-12-213456_likes_add_ap_url/up.sql similarity index 100% rename from migrations/2018-05-12-213456_likes_add_ap_url/up.sql rename to migrations/postgres/2018-05-12-213456_likes_add_ap_url/up.sql diff --git a/migrations/2018-05-13-122311_create_notifications/down.sql b/migrations/postgres/2018-05-13-122311_create_notifications/down.sql similarity index 100% rename from migrations/2018-05-13-122311_create_notifications/down.sql rename to migrations/postgres/2018-05-13-122311_create_notifications/down.sql diff --git a/migrations/2018-05-13-122311_create_notifications/up.sql b/migrations/postgres/2018-05-13-122311_create_notifications/up.sql similarity index 100% rename from migrations/2018-05-13-122311_create_notifications/up.sql rename to migrations/postgres/2018-05-13-122311_create_notifications/up.sql diff --git a/migrations/2018-05-13-175144_users_add_shared_inbox/down.sql b/migrations/postgres/2018-05-13-175144_users_add_shared_inbox/down.sql similarity index 100% rename from migrations/2018-05-13-175144_users_add_shared_inbox/down.sql rename to migrations/postgres/2018-05-13-175144_users_add_shared_inbox/down.sql diff --git a/migrations/2018-05-13-175144_users_add_shared_inbox/up.sql b/migrations/postgres/2018-05-13-175144_users_add_shared_inbox/up.sql similarity index 100% rename from migrations/2018-05-13-175144_users_add_shared_inbox/up.sql rename to migrations/postgres/2018-05-13-175144_users_add_shared_inbox/up.sql diff --git a/migrations/2018-05-19-091428_create_reshares/down.sql b/migrations/postgres/2018-05-19-091428_create_reshares/down.sql similarity index 100% rename from migrations/2018-05-19-091428_create_reshares/down.sql rename to migrations/postgres/2018-05-19-091428_create_reshares/down.sql diff --git a/migrations/2018-05-19-091428_create_reshares/up.sql b/migrations/postgres/2018-05-19-091428_create_reshares/up.sql similarity index 100% rename from migrations/2018-05-19-091428_create_reshares/up.sql rename to migrations/postgres/2018-05-19-091428_create_reshares/up.sql diff --git a/migrations/2018-05-24-100613_add_notifications_creation_date/down.sql b/migrations/postgres/2018-05-24-100613_add_notifications_creation_date/down.sql similarity index 100% rename from migrations/2018-05-24-100613_add_notifications_creation_date/down.sql rename to migrations/postgres/2018-05-24-100613_add_notifications_creation_date/down.sql diff --git a/migrations/2018-05-24-100613_add_notifications_creation_date/up.sql b/migrations/postgres/2018-05-24-100613_add_notifications_creation_date/up.sql similarity index 100% rename from migrations/2018-05-24-100613_add_notifications_creation_date/up.sql rename to migrations/postgres/2018-05-24-100613_add_notifications_creation_date/up.sql diff --git a/migrations/2018-06-17-200302_notification_add_data/down.sql b/migrations/postgres/2018-06-17-200302_notification_add_data/down.sql similarity index 100% rename from migrations/2018-06-17-200302_notification_add_data/down.sql rename to migrations/postgres/2018-06-17-200302_notification_add_data/down.sql diff --git a/migrations/2018-06-17-200302_notification_add_data/up.sql b/migrations/postgres/2018-06-17-200302_notification_add_data/up.sql similarity index 100% rename from migrations/2018-06-17-200302_notification_add_data/up.sql rename to migrations/postgres/2018-06-17-200302_notification_add_data/up.sql diff --git a/migrations/2018-06-20-175532_create_mentions/down.sql b/migrations/postgres/2018-06-20-175532_create_mentions/down.sql similarity index 100% rename from migrations/2018-06-20-175532_create_mentions/down.sql rename to migrations/postgres/2018-06-20-175532_create_mentions/down.sql diff --git a/migrations/2018-06-20-175532_create_mentions/up.sql b/migrations/postgres/2018-06-20-175532_create_mentions/up.sql similarity index 100% rename from migrations/2018-06-20-175532_create_mentions/up.sql rename to migrations/postgres/2018-06-20-175532_create_mentions/up.sql diff --git a/migrations/2018-06-20-194538_add_mentions_ap_url/down.sql b/migrations/postgres/2018-06-20-194538_add_mentions_ap_url/down.sql similarity index 100% rename from migrations/2018-06-20-194538_add_mentions_ap_url/down.sql rename to migrations/postgres/2018-06-20-194538_add_mentions_ap_url/down.sql diff --git a/migrations/2018-06-20-194538_add_mentions_ap_url/up.sql b/migrations/postgres/2018-06-20-194538_add_mentions_ap_url/up.sql similarity index 100% rename from migrations/2018-06-20-194538_add_mentions_ap_url/up.sql rename to migrations/postgres/2018-06-20-194538_add_mentions_ap_url/up.sql diff --git a/migrations/2018-07-25-165754_refactor_notifications/down.sql b/migrations/postgres/2018-07-25-165754_refactor_notifications/down.sql similarity index 100% rename from migrations/2018-07-25-165754_refactor_notifications/down.sql rename to migrations/postgres/2018-07-25-165754_refactor_notifications/down.sql diff --git a/migrations/2018-07-25-165754_refactor_notifications/up.sql b/migrations/postgres/2018-07-25-165754_refactor_notifications/up.sql similarity index 100% rename from migrations/2018-07-25-165754_refactor_notifications/up.sql rename to migrations/postgres/2018-07-25-165754_refactor_notifications/up.sql diff --git a/migrations/2018-07-27-102221_user_add_followers_endpoint/down.sql b/migrations/postgres/2018-07-27-102221_user_add_followers_endpoint/down.sql similarity index 100% rename from migrations/2018-07-27-102221_user_add_followers_endpoint/down.sql rename to migrations/postgres/2018-07-27-102221_user_add_followers_endpoint/down.sql diff --git a/migrations/2018-07-27-102221_user_add_followers_endpoint/up.sql b/migrations/postgres/2018-07-27-102221_user_add_followers_endpoint/up.sql similarity index 100% rename from migrations/2018-07-27-102221_user_add_followers_endpoint/up.sql rename to migrations/postgres/2018-07-27-102221_user_add_followers_endpoint/up.sql diff --git a/migrations/2018-07-27-125558_instance_customization/down.sql b/migrations/postgres/2018-07-27-125558_instance_customization/down.sql similarity index 100% rename from migrations/2018-07-27-125558_instance_customization/down.sql rename to migrations/postgres/2018-07-27-125558_instance_customization/down.sql diff --git a/migrations/2018-07-27-125558_instance_customization/up.sql b/migrations/postgres/2018-07-27-125558_instance_customization/up.sql similarity index 100% rename from migrations/2018-07-27-125558_instance_customization/up.sql rename to migrations/postgres/2018-07-27-125558_instance_customization/up.sql diff --git a/migrations/2018-07-27-194816_instance_description_html/down.sql b/migrations/postgres/2018-07-27-194816_instance_description_html/down.sql similarity index 100% rename from migrations/2018-07-27-194816_instance_description_html/down.sql rename to migrations/postgres/2018-07-27-194816_instance_description_html/down.sql diff --git a/migrations/2018-07-27-194816_instance_description_html/up.sql b/migrations/postgres/2018-07-27-194816_instance_description_html/up.sql similarity index 100% rename from migrations/2018-07-27-194816_instance_description_html/up.sql rename to migrations/postgres/2018-07-27-194816_instance_description_html/up.sql diff --git a/migrations/2018-09-02-111458_create_medias/down.sql b/migrations/postgres/2018-09-02-111458_create_medias/down.sql similarity index 100% rename from migrations/2018-09-02-111458_create_medias/down.sql rename to migrations/postgres/2018-09-02-111458_create_medias/down.sql diff --git a/migrations/2018-09-02-111458_create_medias/up.sql b/migrations/postgres/2018-09-02-111458_create_medias/up.sql similarity index 100% rename from migrations/2018-09-02-111458_create_medias/up.sql rename to migrations/postgres/2018-09-02-111458_create_medias/up.sql diff --git a/migrations/2018-09-02-123623_medias_owner_id/down.sql b/migrations/postgres/2018-09-02-123623_medias_owner_id/down.sql similarity index 100% rename from migrations/2018-09-02-123623_medias_owner_id/down.sql rename to migrations/postgres/2018-09-02-123623_medias_owner_id/down.sql diff --git a/migrations/2018-09-02-123623_medias_owner_id/up.sql b/migrations/postgres/2018-09-02-123623_medias_owner_id/up.sql similarity index 100% rename from migrations/2018-09-02-123623_medias_owner_id/up.sql rename to migrations/postgres/2018-09-02-123623_medias_owner_id/up.sql diff --git a/migrations/2018-09-03-102510_users_add_avatar/down.sql b/migrations/postgres/2018-09-03-102510_users_add_avatar/down.sql similarity index 100% rename from migrations/2018-09-03-102510_users_add_avatar/down.sql rename to migrations/postgres/2018-09-03-102510_users_add_avatar/down.sql diff --git a/migrations/2018-09-03-102510_users_add_avatar/up.sql b/migrations/postgres/2018-09-03-102510_users_add_avatar/up.sql similarity index 100% rename from migrations/2018-09-03-102510_users_add_avatar/up.sql rename to migrations/postgres/2018-09-03-102510_users_add_avatar/up.sql diff --git a/migrations/2018-09-03-170848_user_add_last_fetched_date/down.sql b/migrations/postgres/2018-09-03-170848_user_add_last_fetched_date/down.sql similarity index 100% rename from migrations/2018-09-03-170848_user_add_last_fetched_date/down.sql rename to migrations/postgres/2018-09-03-170848_user_add_last_fetched_date/down.sql diff --git a/migrations/2018-09-03-170848_user_add_last_fetched_date/up.sql b/migrations/postgres/2018-09-03-170848_user_add_last_fetched_date/up.sql similarity index 100% rename from migrations/2018-09-03-170848_user_add_last_fetched_date/up.sql rename to migrations/postgres/2018-09-03-170848_user_add_last_fetched_date/up.sql diff --git a/migrations/2018-09-04-103017_follows_add_ap_url/down.sql b/migrations/postgres/2018-09-04-103017_follows_add_ap_url/down.sql similarity index 100% rename from migrations/2018-09-04-103017_follows_add_ap_url/down.sql rename to migrations/postgres/2018-09-04-103017_follows_add_ap_url/down.sql diff --git a/migrations/2018-09-04-103017_follows_add_ap_url/up.sql b/migrations/postgres/2018-09-04-103017_follows_add_ap_url/up.sql similarity index 100% rename from migrations/2018-09-04-103017_follows_add_ap_url/up.sql rename to migrations/postgres/2018-09-04-103017_follows_add_ap_url/up.sql diff --git a/migrations/2018-09-04-104828_posts_add_subtitle/down.sql b/migrations/postgres/2018-09-04-104828_posts_add_subtitle/down.sql similarity index 100% rename from migrations/2018-09-04-104828_posts_add_subtitle/down.sql rename to migrations/postgres/2018-09-04-104828_posts_add_subtitle/down.sql diff --git a/migrations/2018-09-04-104828_posts_add_subtitle/up.sql b/migrations/postgres/2018-09-04-104828_posts_add_subtitle/up.sql similarity index 100% rename from migrations/2018-09-04-104828_posts_add_subtitle/up.sql rename to migrations/postgres/2018-09-04-104828_posts_add_subtitle/up.sql diff --git a/migrations/2018-09-05-174106_create_tags/down.sql b/migrations/postgres/2018-09-05-174106_create_tags/down.sql similarity index 100% rename from migrations/2018-09-05-174106_create_tags/down.sql rename to migrations/postgres/2018-09-05-174106_create_tags/down.sql diff --git a/migrations/2018-09-05-174106_create_tags/up.sql b/migrations/postgres/2018-09-05-174106_create_tags/up.sql similarity index 100% rename from migrations/2018-09-05-174106_create_tags/up.sql rename to migrations/postgres/2018-09-05-174106_create_tags/up.sql diff --git a/migrations/2018-09-06-182637_posts_add_source/down.sql b/migrations/postgres/2018-09-06-182637_posts_add_source/down.sql similarity index 100% rename from migrations/2018-09-06-182637_posts_add_source/down.sql rename to migrations/postgres/2018-09-06-182637_posts_add_source/down.sql diff --git a/migrations/2018-09-06-182637_posts_add_source/up.sql b/migrations/postgres/2018-09-06-182637_posts_add_source/up.sql similarity index 100% rename from migrations/2018-09-06-182637_posts_add_source/up.sql rename to migrations/postgres/2018-09-06-182637_posts_add_source/up.sql diff --git a/migrations/2018-09-07-212003_fix_avatar_deletion/down.sql b/migrations/postgres/2018-09-07-212003_fix_avatar_deletion/down.sql similarity index 100% rename from migrations/2018-09-07-212003_fix_avatar_deletion/down.sql rename to migrations/postgres/2018-09-07-212003_fix_avatar_deletion/down.sql diff --git a/migrations/2018-09-07-212003_fix_avatar_deletion/up.sql b/migrations/postgres/2018-09-07-212003_fix_avatar_deletion/up.sql similarity index 100% rename from migrations/2018-09-07-212003_fix_avatar_deletion/up.sql rename to migrations/postgres/2018-09-07-212003_fix_avatar_deletion/up.sql diff --git a/migrations/sqlite/2018-04-22-093322_create_instances/down.sql b/migrations/sqlite/2018-04-22-093322_create_instances/down.sql new file mode 100644 index 0000000..1ec93bf --- /dev/null +++ b/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; diff --git a/migrations/sqlite/2018-04-22-093322_create_instances/up.sql b/migrations/sqlite/2018-04-22-093322_create_instances/up.sql new file mode 100644 index 0000000..095f2b6 --- /dev/null +++ b/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 '' +) diff --git a/migrations/sqlite/2018-04-22-151330_create_user/down.sql b/migrations/sqlite/2018-04-22-151330_create_user/down.sql new file mode 100644 index 0000000..dc3714b --- /dev/null +++ b/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; diff --git a/migrations/sqlite/2018-04-22-151330_create_user/up.sql b/migrations/sqlite/2018-04-22-151330_create_user/up.sql new file mode 100644 index 0000000..c26055d --- /dev/null +++ b/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 +); diff --git a/migrations/sqlite/2018-04-23-101717_create_blogs/down.sql b/migrations/sqlite/2018-04-23-101717_create_blogs/down.sql new file mode 100644 index 0000000..4f8b0a6 --- /dev/null +++ b/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; diff --git a/migrations/sqlite/2018-04-23-101717_create_blogs/up.sql b/migrations/sqlite/2018-04-23-101717_create_blogs/up.sql new file mode 100644 index 0000000..734d22d --- /dev/null +++ b/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 '' +) diff --git a/migrations/sqlite/2018-04-23-111655_create_blog_authors/down.sql b/migrations/sqlite/2018-04-23-111655_create_blog_authors/down.sql new file mode 100644 index 0000000..cfb62ab --- /dev/null +++ b/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; diff --git a/migrations/sqlite/2018-04-23-111655_create_blog_authors/up.sql b/migrations/sqlite/2018-04-23-111655_create_blog_authors/up.sql new file mode 100644 index 0000000..58846c6 --- /dev/null +++ b/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' +) diff --git a/migrations/sqlite/2018-04-23-132822_create_posts/down.sql b/migrations/sqlite/2018-04-23-132822_create_posts/down.sql new file mode 100644 index 0000000..56ed16e --- /dev/null +++ b/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; diff --git a/migrations/sqlite/2018-04-23-132822_create_posts/up.sql b/migrations/sqlite/2018-04-23-132822_create_posts/up.sql new file mode 100644 index 0000000..88050a1 --- /dev/null +++ b/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 '' +) diff --git a/migrations/sqlite/2018-04-23-142746_create_post_authors/down.sql b/migrations/sqlite/2018-04-23-142746_create_post_authors/down.sql new file mode 100644 index 0000000..129bf59 --- /dev/null +++ b/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; diff --git a/migrations/sqlite/2018-04-23-142746_create_post_authors/up.sql b/migrations/sqlite/2018-04-23-142746_create_post_authors/up.sql new file mode 100644 index 0000000..49991af --- /dev/null +++ b/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 +) diff --git a/migrations/sqlite/2018-05-01-124607_create_follow/down.sql b/migrations/sqlite/2018-05-01-124607_create_follow/down.sql new file mode 100644 index 0000000..eee3b97 --- /dev/null +++ b/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; diff --git a/migrations/sqlite/2018-05-01-124607_create_follow/up.sql b/migrations/sqlite/2018-05-01-124607_create_follow/up.sql new file mode 100644 index 0000000..c31d232 --- /dev/null +++ b/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 '' +) diff --git a/migrations/sqlite/2018-05-09-192013_create_comments/down.sql b/migrations/sqlite/2018-05-09-192013_create_comments/down.sql new file mode 100644 index 0000000..d0841ff --- /dev/null +++ b/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; diff --git a/migrations/sqlite/2018-05-09-192013_create_comments/up.sql b/migrations/sqlite/2018-05-09-192013_create_comments/up.sql new file mode 100644 index 0000000..aec4ce1 --- /dev/null +++ b/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 '' +) diff --git a/migrations/sqlite/2018-05-10-154336_create_likes/down.sql b/migrations/sqlite/2018-05-10-154336_create_likes/down.sql new file mode 100644 index 0000000..2232ad5 --- /dev/null +++ b/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; diff --git a/migrations/sqlite/2018-05-10-154336_create_likes/up.sql b/migrations/sqlite/2018-05-10-154336_create_likes/up.sql new file mode 100644 index 0000000..11b09d6 --- /dev/null +++ b/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 +) diff --git a/migrations/sqlite/2018-05-13-122311_create_notifications/down.sql b/migrations/sqlite/2018-05-13-122311_create_notifications/down.sql new file mode 100644 index 0000000..bcebcc0 --- /dev/null +++ b/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; diff --git a/migrations/sqlite/2018-05-13-122311_create_notifications/up.sql b/migrations/sqlite/2018-05-13-122311_create_notifications/up.sql new file mode 100644 index 0000000..0266e41 --- /dev/null +++ b/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 +) diff --git a/migrations/sqlite/2018-05-19-091428_create_reshares/down.sql b/migrations/sqlite/2018-05-19-091428_create_reshares/down.sql new file mode 100644 index 0000000..29a2d0f --- /dev/null +++ b/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; diff --git a/migrations/sqlite/2018-05-19-091428_create_reshares/up.sql b/migrations/sqlite/2018-05-19-091428_create_reshares/up.sql new file mode 100644 index 0000000..9435b7d --- /dev/null +++ b/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 +) diff --git a/migrations/sqlite/2018-06-20-175532_create_mentions/down.sql b/migrations/sqlite/2018-06-20-175532_create_mentions/down.sql new file mode 100644 index 0000000..e860c9a --- /dev/null +++ b/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; diff --git a/migrations/sqlite/2018-06-20-175532_create_mentions/up.sql b/migrations/sqlite/2018-06-20-175532_create_mentions/up.sql new file mode 100644 index 0000000..35cc3b5 --- /dev/null +++ b/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 '' +) diff --git a/migrations/sqlite/2018-09-02-111458_create_medias/down.sql b/migrations/sqlite/2018-09-02-111458_create_medias/down.sql new file mode 100644 index 0000000..3ba0178 --- /dev/null +++ b/migrations/sqlite/2018-09-02-111458_create_medias/down.sql @@ -0,0 +1,2 @@ +-- This file should undo anything in `up.sql` +DROP TABLE medias; diff --git a/migrations/sqlite/2018-09-02-111458_create_medias/up.sql b/migrations/sqlite/2018-09-02-111458_create_medias/up.sql new file mode 100644 index 0000000..3f804e2 --- /dev/null +++ b/migrations/sqlite/2018-09-02-111458_create_medias/up.sql @@ -0,0 +1,11 @@ +-- Your SQL goes here +CREATE TABLE medias ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + file_path TEXT NOT NULL DEFAULT '', + alt_text TEXT NOT NULL DEFAULT '', + is_remote BOOLEAN NOT NULL DEFAULT 'f', + remote_url TEXT, + sensitive BOOLEAN NOT NULL DEFAULT 'f', + content_warning TEXT, + owner_id INTEGER REFERENCES users(id) ON DELETE CASCADE NOT NULL +) diff --git a/migrations/sqlite/2018-09-05-174106_create_tags/down.sql b/migrations/sqlite/2018-09-05-174106_create_tags/down.sql new file mode 100644 index 0000000..43c79a4 --- /dev/null +++ b/migrations/sqlite/2018-09-05-174106_create_tags/down.sql @@ -0,0 +1,2 @@ +-- This file should undo anything in `up.sql` +DROP TABLE tags; diff --git a/migrations/sqlite/2018-09-05-174106_create_tags/up.sql b/migrations/sqlite/2018-09-05-174106_create_tags/up.sql new file mode 100644 index 0000000..15e95be --- /dev/null +++ b/migrations/sqlite/2018-09-05-174106_create_tags/up.sql @@ -0,0 +1,7 @@ +-- Your SQL goes here +CREATE TABLE tags ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + tag TEXT NOT NULL DEFAULT '', + is_hastag BOOLEAN NOT NULL DEFAULT 'f', + post_id INTEGER REFERENCES posts(id) ON DELETE CASCADE NOT NULL +) diff --git a/plume-models/src/schema.rs b/plume-models/src/schema.rs index 7d51d67..d80f9c9 100644 --- a/plume-models/src/schema.rs +++ b/plume-models/src/schema.rs @@ -1,22 +1,22 @@ table! { blog_authors (id) { - id -> Int4, - blog_id -> Int4, - author_id -> Int4, + id -> Nullable, + blog_id -> Integer, + author_id -> Integer, is_owner -> Bool, } } table! { blogs (id) { - id -> Int4, - actor_id -> Varchar, - title -> Varchar, + id -> Nullable, + actor_id -> Text, + title -> Text, summary -> Text, - outbox_url -> Varchar, - inbox_url -> Varchar, - instance_id -> Int4, - creation_date -> Timestamp, + outbox_url -> Text, + inbox_url -> Text, + instance_id -> Integer, + creation_date -> Integer, ap_url -> Text, private_key -> Nullable, public_key -> Text, @@ -25,13 +25,13 @@ table! { table! { comments (id) { - id -> Int4, + id -> Nullable, content -> Text, - in_response_to_id -> Nullable, - post_id -> Int4, - author_id -> Int4, - creation_date -> Timestamp, - ap_url -> Nullable, + in_response_to_id -> Nullable, + post_id -> Integer, + author_id -> Integer, + creation_date -> Integer, + ap_url -> Nullable, sensitive -> Bool, spoiler_text -> Text, } @@ -39,92 +39,92 @@ table! { table! { follows (id) { - id -> Int4, - follower_id -> Int4, - following_id -> Int4, + id -> Nullable, + follower_id -> Integer, + following_id -> Integer, ap_url -> Text, } } table! { instances (id) { - id -> Int4, - public_domain -> Varchar, - name -> Varchar, + id -> Nullable, + public_domain -> Text, + name -> Text, local -> Bool, blocked -> Bool, - creation_date -> Timestamp, + creation_date -> Integer, open_registrations -> Bool, short_description -> Text, long_description -> Text, default_license -> Text, - long_description_html -> Varchar, - short_description_html -> Varchar, + long_description_html -> Text, + short_description_html -> Text, } } table! { likes (id) { - id -> Int4, - user_id -> Int4, - post_id -> Int4, - creation_date -> Timestamp, - ap_url -> Varchar, + id -> Nullable, + user_id -> Integer, + post_id -> Integer, + ap_url -> Text, + creation_date -> Integer, } } table! { medias (id) { - id -> Int4, + id -> Nullable, file_path -> Text, alt_text -> Text, is_remote -> Bool, remote_url -> Nullable, sensitive -> Bool, content_warning -> Nullable, - owner_id -> Int4, + owner_id -> Integer, } } table! { mentions (id) { - id -> Int4, - mentioned_id -> Int4, - post_id -> Nullable, - comment_id -> Nullable, - ap_url -> Varchar, + id -> Nullable, + mentioned_id -> Integer, + post_id -> Nullable, + comment_id -> Nullable, + ap_url -> Text, } } table! { notifications (id) { - id -> Int4, - user_id -> Int4, - creation_date -> Timestamp, - kind -> Varchar, - object_id -> Int4, + id -> Nullable, + user_id -> Integer, + creation_date -> Integer, + kind -> Text, + object_id -> Integer, } } table! { post_authors (id) { - id -> Int4, - post_id -> Int4, - author_id -> Int4, + id -> Nullable, + post_id -> Integer, + author_id -> Integer, } } table! { posts (id) { - id -> Int4, - blog_id -> Int4, - slug -> Varchar, - title -> Varchar, + id -> Nullable, + blog_id -> Integer, + slug -> Text, + title -> Text, content -> Text, published -> Bool, - license -> Varchar, - creation_date -> Timestamp, - ap_url -> Varchar, + license -> Text, + creation_date -> Integer, + ap_url -> Text, subtitle -> Text, source -> Text, } @@ -132,42 +132,42 @@ table! { table! { reshares (id) { - id -> Int4, - user_id -> Int4, - post_id -> Int4, - ap_url -> Varchar, - creation_date -> Timestamp, + id -> Nullable, + user_id -> Integer, + post_id -> Integer, + ap_url -> Text, + creation_date -> Integer, } } table! { tags (id) { - id -> Int4, + id -> Nullable, tag -> Text, is_hastag -> Bool, - post_id -> Int4, + post_id -> Integer, } } table! { users (id) { - id -> Int4, - username -> Varchar, - display_name -> Varchar, - outbox_url -> Varchar, - inbox_url -> Varchar, + id -> Nullable, + username -> Text, + display_name -> Text, + outbox_url -> Text, + inbox_url -> Text, is_admin -> Bool, summary -> Text, email -> Nullable, hashed_password -> Nullable, - instance_id -> Int4, - creation_date -> Timestamp, + instance_id -> Integer, + creation_date -> Integer, ap_url -> Text, private_key -> Nullable, public_key -> Text, - shared_inbox_url -> Nullable, - followers_endpoint -> Varchar, - avatar_id -> Nullable, + shared_inbox_url -> Nullable, + followers_endpoint -> Text, + avatar_id -> Nullable, last_fetched_date -> Timestamp, } }