-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FIX: ensures migration order is correct (#27)
- Loading branch information
Showing
5 changed files
with
55 additions
and
39 deletions.
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
db/migrate/20200409102639_drop_incorrect_future_schema_migrations.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# frozen_string_literal: true | ||
|
||
class DropIncorrectFutureSchemaMigrations < ActiveRecord::Migration[5.2] | ||
def up | ||
execute <<-SQL | ||
DELETE FROM schema_migrations WHERE version = '20201303000001'; | ||
DELETE FROM schema_migration_details WHERE version = '20201303000001'; | ||
DELETE FROM schema_migrations WHERE version = '20201303000002'; | ||
DELETE FROM schema_migration_details WHERE version = '20201303000002'; | ||
SQL | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# frozen_string_literal: true | ||
|
||
class CreatePostEventsTable < ActiveRecord::Migration[5.2] | ||
def up | ||
unless ActiveRecord::Base.connection.table_exists?('discourse_calendar_post_events') | ||
create_table :discourse_calendar_post_events, id: false do |t| | ||
t.bigint :id, null: false, primary_key: true | ||
t.integer :status, default: 0, null: false | ||
t.integer :display_invitees, default: 0, null: false | ||
t.datetime :starts_at, null: false, default: -> { 'CURRENT_TIMESTAMP' } | ||
t.datetime :ends_at | ||
t.datetime :deleted_at | ||
t.string :raw_invitees, array: true | ||
t.string :name | ||
end | ||
end | ||
end | ||
|
||
def down | ||
drop_table :discourse_calendar_post_events | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# frozen_string_literal: true | ||
|
||
class CreateInviteesTable < ActiveRecord::Migration[5.2] | ||
def up | ||
unless ActiveRecord::Base.connection.table_exists?('discourse_calendar_invitees') | ||
create_table :discourse_calendar_invitees do |t| | ||
t.integer :post_id, null: false | ||
t.integer :user_id, null: false | ||
t.integer :status | ||
t.timestamps null: false | ||
t.boolean :notified, null: false, default: false | ||
end | ||
|
||
add_index :discourse_calendar_invitees, [:post_id, :user_id], unique: true | ||
end | ||
end | ||
|
||
def down | ||
drop_table :discourse_calendar_invitees | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.