• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Best way to overwrite certain tables in db

#1
What is the best way to overwrite certain tables in my database?

Should I use migrations?

Or should I do something like this.

#1 Drop the table that needs amending.
#2 Do a mysql insert with new table?

Thank you in advance.
Practical guide to IgnitedCMS - Book coming soon
Reply

#2
@ignitedcms,

I think it depends on the situation. Is there data in them there tables??? If so, are you sure that deleting it is the right path. If you are amending the table you could just do an alter table. I'm always cautious about deleting. I would prefer to backup then delete or if possible rename then recreate.
Reply

#3
(09-13-2018, 09:03 AM)php_rocs Wrote: @ignitedcms,

I think it depends on the situation.  Is there data in them there tables???  If so, are you sure that deleting it is the right path.  If you are amending the table you could just do an alter table. I'm always cautious about deleting.  I would prefer to backup then delete or if possible rename then recreate.

Hi thank you for your reply, essentially ONLY one table needs to remain, the rest can be dropped entirely and the new data inserted.
Practical guide to IgnitedCMS - Book coming soon
Reply

#4
@ignitedcms,

Oh, ok. Your just asking a straight database question. I thought is was related to a database with pre-existing data.
Reply

#5
This depends on what you need to do.

If you just need to add more fields then use the Alter Table.

If you need to change field names etc; Then you would need to drop the table
and create a new one.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply

#6
Thank you guys, I think I've got enough ideas to move forward with this.
Practical guide to IgnitedCMS - Book coming soon
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2018 MyBB Group.