Move DB dir
This commit is contained in:
12
config/db/migrate/20230101035642_create_posts.rb
Normal file
12
config/db/migrate/20230101035642_create_posts.rb
Normal file
@@ -0,0 +1,12 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
ROM::SQL.migration do
|
||||
change do
|
||||
create_table :posts do
|
||||
primary_key :id
|
||||
column :name, :text, null: false, default: ""
|
||||
column :content, :text, null: false
|
||||
column :published_at, :timestamp
|
||||
end
|
||||
end
|
||||
end
|
9
config/db/migrate/20230101113513_add_slug_to_posts.rb
Normal file
9
config/db/migrate/20230101113513_add_slug_to_posts.rb
Normal file
@@ -0,0 +1,9 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
ROM::SQL.migration do
|
||||
change do
|
||||
alter_table :posts do
|
||||
add_column :slug, :text, null: false
|
||||
end
|
||||
end
|
||||
end
|
@@ -0,0 +1,9 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
ROM::SQL.migration do
|
||||
change do
|
||||
alter_table :posts do
|
||||
add_unique_constraint :slug
|
||||
end
|
||||
end
|
||||
end
|
13
config/db/migrate/20230102075558_create_bookmarks.rb
Normal file
13
config/db/migrate/20230102075558_create_bookmarks.rb
Normal file
@@ -0,0 +1,13 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
ROM::SQL.migration do
|
||||
change do
|
||||
create_table :bookmarks do
|
||||
primary_key :id
|
||||
column :url, :text, null: false
|
||||
column :name, :text, null: false
|
||||
column :content, :text, null: false, default: ""
|
||||
column :published_at, :timestamp
|
||||
end
|
||||
end
|
||||
end
|
@@ -0,0 +1,9 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
ROM::SQL.migration do
|
||||
change do
|
||||
alter_table :bookmarks do
|
||||
add_column :slug, :text, null: false, unique: true
|
||||
end
|
||||
end
|
||||
end
|
16
config/db/migrate/20230103215123_create_tags.rb
Normal file
16
config/db/migrate/20230103215123_create_tags.rb
Normal file
@@ -0,0 +1,16 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
ROM::SQL.migration do
|
||||
change do
|
||||
create_table :tags do
|
||||
primary_key :id
|
||||
column :label, :text, null: false, unique: true
|
||||
column :slug, :text, null: false, unique: true
|
||||
end
|
||||
|
||||
create_table :post_tags do
|
||||
foreign_key :post_id, :posts, null: false
|
||||
foreign_key :tag_id, :tags, null: false
|
||||
end
|
||||
end
|
||||
end
|
@@ -0,0 +1,11 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
ROM::SQL.migration do
|
||||
change do
|
||||
drop_table :bookmarks
|
||||
alter_table :posts do
|
||||
add_column :url, :text
|
||||
add_column :post_type, :text
|
||||
end
|
||||
end
|
||||
end
|
@@ -0,0 +1,9 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
ROM::SQL.migration do
|
||||
change do
|
||||
alter_table :posts do
|
||||
set_column_allow_null :content
|
||||
end
|
||||
end
|
||||
end
|
@@ -0,0 +1,9 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
ROM::SQL.migration do
|
||||
change do
|
||||
alter_table :posts do
|
||||
set_column_allow_null :name
|
||||
end
|
||||
end
|
||||
end
|
@@ -0,0 +1,9 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
ROM::SQL.migration do
|
||||
change do
|
||||
alter_table :posts do
|
||||
add_column :syndication_sources, :json, default: "{}"
|
||||
end
|
||||
end
|
||||
end
|
9
config/db/migrate/20230131084956_add_photos_to_posts.rb
Normal file
9
config/db/migrate/20230131084956_add_photos_to_posts.rb
Normal file
@@ -0,0 +1,9 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
ROM::SQL.migration do
|
||||
change do
|
||||
alter_table :posts do
|
||||
add_column :photos, :json, default: "[]", null: false
|
||||
end
|
||||
end
|
||||
end
|
@@ -0,0 +1,9 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
ROM::SQL.migration do
|
||||
change do
|
||||
alter_table :posts do
|
||||
add_column :location, :text, default: nil
|
||||
end
|
||||
end
|
||||
end
|
@@ -0,0 +1,9 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
ROM::SQL.migration do
|
||||
change do
|
||||
alter_table(:posts) do
|
||||
set_column_type :syndication_sources, :jsonb
|
||||
end
|
||||
end
|
||||
end
|
12
config/db/migrate/20230424120318_create_workouts.rb
Normal file
12
config/db/migrate/20230424120318_create_workouts.rb
Normal file
@@ -0,0 +1,12 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
ROM::SQL.migration do
|
||||
change do
|
||||
create_table :workouts do
|
||||
primary_key :id
|
||||
column :path, :text, null: false
|
||||
column :distance, :float, null: false
|
||||
column :published_at, :timestamp
|
||||
end
|
||||
end
|
||||
end
|
@@ -0,0 +1,9 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
ROM::SQL.migration do
|
||||
change do
|
||||
alter_table :workouts do
|
||||
add_column :duration, :float, null: false
|
||||
end
|
||||
end
|
||||
end
|
12
config/db/migrate/20230501111415_create_movies.rb
Normal file
12
config/db/migrate/20230501111415_create_movies.rb
Normal file
@@ -0,0 +1,12 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
ROM::SQL.migration do
|
||||
change do
|
||||
create_table :movies do
|
||||
primary_key :id
|
||||
column :title, :text, null: false
|
||||
column :year, :integer
|
||||
column :url, :text, null: false
|
||||
end
|
||||
end
|
||||
end
|
12
config/db/migrate/20230506081449_create_auto_taggings.rb
Normal file
12
config/db/migrate/20230506081449_create_auto_taggings.rb
Normal file
@@ -0,0 +1,12 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
ROM::SQL.migration do
|
||||
change do
|
||||
create_table(:auto_taggings) do
|
||||
primary_key :id
|
||||
column :title_contains, :text
|
||||
column :body_contains, :text
|
||||
foreign_key :tag_id, :tags, null: false
|
||||
end
|
||||
end
|
||||
end
|
@@ -0,0 +1,9 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
ROM::SQL.migration do
|
||||
change do
|
||||
alter_table(:posts) do
|
||||
add_column :cached_content, :text
|
||||
end
|
||||
end
|
||||
end
|
15
config/db/migrate/20230508101336_add_que.rb
Normal file
15
config/db/migrate/20230508101336_add_que.rb
Normal file
@@ -0,0 +1,15 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "que"
|
||||
|
||||
ROM::SQL.migration do
|
||||
up do
|
||||
Que.connection = self
|
||||
Que.migrate!(version: 7)
|
||||
end
|
||||
|
||||
down do
|
||||
Que.connection = self
|
||||
Que.migrate!(version: 0)
|
||||
end
|
||||
end
|
14
config/db/migrate/20230509092845_create_trips.rb
Normal file
14
config/db/migrate/20230509092845_create_trips.rb
Normal file
@@ -0,0 +1,14 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
ROM::SQL.migration do
|
||||
change do
|
||||
create_table :trips do
|
||||
primary_key :id
|
||||
column :name, :text, null: false
|
||||
column :start_date, :date, null: false
|
||||
column :end_date, :date, null: false
|
||||
# column :latitude, :float, null: false
|
||||
# column :longitude, :float, null: false
|
||||
end
|
||||
end
|
||||
end
|
10
config/db/migrate/20230509094041_create_post_trips.rb
Normal file
10
config/db/migrate/20230509094041_create_post_trips.rb
Normal file
@@ -0,0 +1,10 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
ROM::SQL.migration do
|
||||
change do
|
||||
create_table :post_trips do
|
||||
foreign_key :post_id, :posts, null: false
|
||||
foreign_key :trip_id, :trips, null: false
|
||||
end
|
||||
end
|
||||
end
|
@@ -0,0 +1,9 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
ROM::SQL.migration do
|
||||
change do
|
||||
alter_table :trips do
|
||||
add_column :subtitle, :text
|
||||
end
|
||||
end
|
||||
end
|
@@ -0,0 +1,9 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
ROM::SQL.migration do
|
||||
change do
|
||||
alter_table :movies do
|
||||
add_column :watched_at, :date
|
||||
end
|
||||
end
|
||||
end
|
@@ -0,0 +1,9 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
ROM::SQL.migration do
|
||||
change do
|
||||
alter_table :movies do
|
||||
add_column :imdb_id, :text
|
||||
end
|
||||
end
|
||||
end
|
13
config/db/migrate/20230612061813_create_top_tracks.rb
Normal file
13
config/db/migrate/20230612061813_create_top_tracks.rb
Normal file
@@ -0,0 +1,13 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
ROM::SQL.migration do
|
||||
change do
|
||||
create_table :top_tracks do
|
||||
column :artist, :text
|
||||
column :name, :text
|
||||
column :url, :text
|
||||
column :mb_id, :text # musicbrainz.org ID
|
||||
foreign_key :post_id, :posts, null: false, unique: true
|
||||
end
|
||||
end
|
||||
end
|
12
config/db/migrate/20230618050051_create_podcasts.rb
Normal file
12
config/db/migrate/20230618050051_create_podcasts.rb
Normal file
@@ -0,0 +1,12 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
ROM::SQL.migration do
|
||||
change do
|
||||
create_table :podcasts do
|
||||
primary_key :id
|
||||
column :name, :text, null: false
|
||||
column :url, :text, null: false
|
||||
column :overcast_id, :text, null: false
|
||||
end
|
||||
end
|
||||
end
|
10
config/db/migrate/20230626090009_add_book_posts.rb
Normal file
10
config/db/migrate/20230626090009_add_book_posts.rb
Normal file
@@ -0,0 +1,10 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
ROM::SQL.migration do
|
||||
change do
|
||||
alter_table :posts do
|
||||
add_column :book_status, :text, default: nil
|
||||
add_column :book_author, :text, default: nil
|
||||
end
|
||||
end
|
||||
end
|
24
config/db/migrate/20230704111528_create_webmentions.rb
Normal file
24
config/db/migrate/20230704111528_create_webmentions.rb
Normal file
@@ -0,0 +1,24 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
ROM::SQL.migration do
|
||||
change do
|
||||
create_table :webmentions do
|
||||
primary_key :id
|
||||
column :type, :text, null: false, default: ""
|
||||
|
||||
column :author_name, :text, null: false, default: ""
|
||||
column :author_photo, :text, null: false, default: ""
|
||||
column :author_url, :text, default: ""
|
||||
|
||||
column :published_at, :timestamp
|
||||
|
||||
column :content_html, :text, null: false, default: ""
|
||||
column :content_text, :text, null: false, default: ""
|
||||
|
||||
column :source_url, :text, null: false, default: ""
|
||||
column :target_url, :text, null: false, default: ""
|
||||
|
||||
foreign_key :post_id, :posts
|
||||
end
|
||||
end
|
||||
end
|
9
config/db/migrate/20230825091941_add_summary_to_trips.rb
Normal file
9
config/db/migrate/20230825091941_add_summary_to_trips.rb
Normal file
@@ -0,0 +1,9 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
ROM::SQL.migration do
|
||||
change do
|
||||
alter_table :trips do
|
||||
add_column :summary, :text, default: nil
|
||||
end
|
||||
end
|
||||
end
|
15
config/db/migrate/20231117222529_create_pages.rb
Normal file
15
config/db/migrate/20231117222529_create_pages.rb
Normal file
@@ -0,0 +1,15 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
ROM::SQL.migration do
|
||||
change do
|
||||
create_table :pages do
|
||||
primary_key :id
|
||||
column :name, :text, null: false
|
||||
column :content, :text, null: false
|
||||
column :slug, :text, null: false
|
||||
column :published_at, :date
|
||||
|
||||
index :slug, unique: true
|
||||
end
|
||||
end
|
||||
end
|
10
config/db/migrate/20231118054424_create_users.rb
Normal file
10
config/db/migrate/20231118054424_create_users.rb
Normal file
@@ -0,0 +1,10 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
ROM::SQL.migration do
|
||||
change do
|
||||
create_table :users do
|
||||
uuid :id, primary_key: true
|
||||
column :email, :text, null: false, unique: true
|
||||
end
|
||||
end
|
||||
end
|
12
config/db/migrate/20231118054707_create_login_token.rb
Normal file
12
config/db/migrate/20231118054707_create_login_token.rb
Normal file
@@ -0,0 +1,12 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
ROM::SQL.migration do
|
||||
change do
|
||||
create_table :login_tokens do
|
||||
primary_key :id
|
||||
column :user_id, :uuid, null: false
|
||||
column :token, :uuid, null: false
|
||||
column :created_at, :timestamptz, default: Sequel.lit("now()")
|
||||
end
|
||||
end
|
||||
end
|
17
config/db/migrate/20231130095816_create_podcast_scrobbles.rb
Normal file
17
config/db/migrate/20231130095816_create_podcast_scrobbles.rb
Normal file
@@ -0,0 +1,17 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
ROM::SQL.migration do
|
||||
change do
|
||||
create_table :podcast_scrobbles do
|
||||
primary_key :id
|
||||
column :overcast_id, :text
|
||||
column :podcast_name, :text
|
||||
column :title, :text
|
||||
column :url, :text
|
||||
column :enclosure_url, :text
|
||||
column :listened_at, :date
|
||||
|
||||
index :overcast_id
|
||||
end
|
||||
end
|
||||
end
|
11
config/db/migrate/20240101043215_add_menu_fields_to_pages.rb
Normal file
11
config/db/migrate/20240101043215_add_menu_fields_to_pages.rb
Normal file
@@ -0,0 +1,11 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
ROM::SQL.migration do
|
||||
change do
|
||||
alter_table :pages do
|
||||
add_column :main_menu, :boolean, default: false
|
||||
add_column :light_colour, :text
|
||||
add_column :dark_colour, :text
|
||||
end
|
||||
end
|
||||
end
|
9
config/db/migrate/20240125232452_add_rating_to_movies.rb
Normal file
9
config/db/migrate/20240125232452_add_rating_to_movies.rb
Normal file
@@ -0,0 +1,9 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
ROM::SQL.migration do
|
||||
change do
|
||||
alter_table(:movies) do
|
||||
add_column :rating, :float, default: 0.0
|
||||
end
|
||||
end
|
||||
end
|
@@ -0,0 +1,9 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
ROM::SQL.migration do
|
||||
change do
|
||||
alter_table :webmentions do
|
||||
add_column :retrieval_attempts, :integer, default: 0
|
||||
end
|
||||
end
|
||||
end
|
@@ -0,0 +1,9 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
ROM::SQL.migration do
|
||||
change do
|
||||
alter_table :webmentions do
|
||||
add_column :last_checked_at, :timestamp
|
||||
end
|
||||
end
|
||||
end
|
@@ -0,0 +1,9 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
ROM::SQL.migration do
|
||||
change do
|
||||
alter_table :posts do
|
||||
add_column :is_read, :bool, default: false
|
||||
end
|
||||
end
|
||||
end
|
37
config/db/migrate/20240303091643_add_updated_at_to_pages.rb
Normal file
37
config/db/migrate/20240303091643_add_updated_at_to_pages.rb
Normal file
@@ -0,0 +1,37 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
ROM::SQL.migration do
|
||||
up do
|
||||
execute <<-SQL
|
||||
CREATE OR REPLACE FUNCTION update_updated_at_column()
|
||||
RETURNS TRIGGER AS $$
|
||||
BEGIN
|
||||
NEW.updated_at = (now() at time zone 'utc');
|
||||
RETURN NEW;
|
||||
END;
|
||||
$$ language 'plpgsql';
|
||||
SQL
|
||||
|
||||
alter_table :pages do
|
||||
add_column :updated_at, :timestamp
|
||||
end
|
||||
|
||||
run <<-SQL
|
||||
CREATE TRIGGER update_pages_updated_at BEFORE UPDATE
|
||||
ON pages FOR EACH ROW EXECUTE PROCEDURE
|
||||
update_updated_at_column();
|
||||
SQL
|
||||
end
|
||||
|
||||
down do
|
||||
execute("DROP FUNCTION IF EXISTS update_updated_at_column();")
|
||||
|
||||
run <<-SQL
|
||||
DROP TRIGGER IF EXISTS update_pages_updated_at ON pages;
|
||||
SQL
|
||||
|
||||
alter_table :pages do
|
||||
drop_column :updated_at
|
||||
end
|
||||
end
|
||||
end
|
@@ -0,0 +1,9 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
ROM::SQL.migration do
|
||||
change do
|
||||
alter_table :posts do
|
||||
add_column :programming_language, :text
|
||||
end
|
||||
end
|
||||
end
|
@@ -0,0 +1,9 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
ROM::SQL.migration do
|
||||
change do
|
||||
alter_table :posts do
|
||||
add_column :commentable, :boolean, default: false
|
||||
end
|
||||
end
|
||||
end
|
@@ -0,0 +1,9 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
ROM::SQL.migration do
|
||||
change do
|
||||
alter_table :posts do
|
||||
add_column :in_reply_to, :text
|
||||
end
|
||||
end
|
||||
end
|
9
config/db/migrate/20240324053509_add_emoji_to_posts.rb
Normal file
9
config/db/migrate/20240324053509_add_emoji_to_posts.rb
Normal file
@@ -0,0 +1,9 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
ROM::SQL.migration do
|
||||
change do
|
||||
alter_table :posts do
|
||||
add_column :emoji, :text
|
||||
end
|
||||
end
|
||||
end
|
14
config/db/migrate/20240330213418_create_reactions.rb
Normal file
14
config/db/migrate/20240330213418_create_reactions.rb
Normal file
@@ -0,0 +1,14 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
ROM::SQL.migration do
|
||||
change do
|
||||
create_table :reactions do
|
||||
primary_key :id
|
||||
foreign_key :post_id, :posts, null: false
|
||||
column :visitor_identifier, :text, null: false
|
||||
|
||||
index :post_id
|
||||
unique [:post_id, :visitor_identifier]
|
||||
end
|
||||
end
|
||||
end
|
13
config/db/migrate/20240405092210_create_highlights.rb
Normal file
13
config/db/migrate/20240405092210_create_highlights.rb
Normal file
@@ -0,0 +1,13 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
ROM::SQL.migration do
|
||||
change do
|
||||
create_table :highlights do
|
||||
primary_key :id
|
||||
foreign_key :post_id, :posts, null: false
|
||||
column :text, :text, null: false
|
||||
|
||||
index :post_id
|
||||
end
|
||||
end
|
||||
end
|
1116
config/db/structure.sql
Normal file
1116
config/db/structure.sql
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user