Skip to content

Commit

Permalink
[api] fix the old migration the right way
Browse files Browse the repository at this point in the history
  • Loading branch information
coolo committed Nov 1, 2012
1 parent 64c715f commit 3b0bebc
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 21 deletions.
18 changes: 18 additions & 0 deletions src/api/db/migrate/20120407173644_remove_devel_project.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
class RemoveDevelProject < ActiveRecord::Migration
class DbPackage < ActiveRecord::Base; end
def up
packs = DbPackage.where("develproject_id is not null").all

unless packs.empty?
puts packs.inspect
raise "Migrate to 2.3 first and run ./script/migrate_devel_projects"
end

execute("alter table db_packages drop FOREIGN KEY db_packages_ibfk_2")
remove_column :db_packages, :develproject_id

end

def down
end
end
17 changes: 0 additions & 17 deletions src/api/db/migrate/20121031121807_remove_devel_project.rb

This file was deleted.

6 changes: 2 additions & 4 deletions src/api/db/structure.sql
Original file line number Diff line number Diff line change
Expand Up @@ -959,6 +959,8 @@ INSERT INTO schema_migrations (version) VALUES ('20120319133739');

INSERT INTO schema_migrations (version) VALUES ('20120320134850');

INSERT INTO schema_migrations (version) VALUES ('20120407173644');

INSERT INTO schema_migrations (version) VALUES ('20120411112931');

INSERT INTO schema_migrations (version) VALUES ('20120411121152');
Expand All @@ -967,8 +969,6 @@ INSERT INTO schema_migrations (version) VALUES ('20120417115800');

INSERT INTO schema_migrations (version) VALUES ('20120418121859');

INSERT INTO schema_migrations (version) VALUES ('20120424141421');

INSERT INTO schema_migrations (version) VALUES ('20120529150500');

INSERT INTO schema_migrations (version) VALUES ('20120903122955');
Expand All @@ -981,8 +981,6 @@ INSERT INTO schema_migrations (version) VALUES ('20121014124846');

INSERT INTO schema_migrations (version) VALUES ('20121015121807');

INSERT INTO schema_migrations (version) VALUES ('20121031121807');

INSERT INTO schema_migrations (version) VALUES ('21');

INSERT INTO schema_migrations (version) VALUES ('22');
Expand Down

0 comments on commit 3b0bebc

Please sign in to comment.