Destroys a user table physically from the database

1.0
Fernando Espinosa 14 years ago
parent f180b6992e
commit 51df87a44e

@ -149,15 +149,11 @@ class Table < Sequel::Model(:user_tables)
end
end
def before_destroy
super
delete_constraints
end
def after_destroy
super
Tag.filter(:user_id => user_id, :table_id => id).delete
User.filter(:id => user_id).update(:tables_count => :tables_count - 1)
owner.in_database{|user_database| user_database.drop_table(name)}
end
## End of Callbacks

@ -310,9 +310,10 @@ describe Table do
table.destroy
user.reload
user.tables_count.should == 0
table.constraints.count.should == 0
Tag.count.should == 0
Table.count == 0
user.in_database{|database| database.table_exists?(table.name).should be_false}
table.constraints.count.should == 0
end
it "can be created with a given schema if it is valid" do

Loading…
Cancel
Save