Skip to content

jardayn/database_reorderer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Database Reordererererer

Some people want order in their Databases.
Like, wanting the last 2 columns to be date_created and date_modified;
But after a while, business requirements and lazyness creep in, and the dreams fade. And they're stuck with an ugly unordered DB.

Come the DB Reorderer.

Clone it the repo.
Enter the directory
Start the server

git clone [email protected]:jardayn/database_reorderer.git  
cd database_reorderer  
php -S localhost:8000

Go to http://localhost:8000

Enter your DB info: Acc/Pass/Host/DbName

Enter the order of columns you want at the start and the end of your table.

Click Submit. You will get a list of tables in the DB.
If you don't want to reorder some tables - you can delete which one's you don't want reordered.

Then click submit again.
You'll get a list of queries that you need to run to satisfy your OCD

And now it's time for the quirks and features

Will it reorder tables that are already in order?

If everything is in order - it will ignore the table.
If you want id,first_name,last_name to be the first columns, and the first 2 columns of the table ar id,first_name - it will only move the last_name column. But, if the final columns are not in perfect order - it's gonna generate the query to adjust all of them.

What if a column in the order doesn't exist?

The DBRO will ignore columns that do not exist on a table. So if you have only id,last_name but not first_name - it will reorder the table to have id,last_name in the front. Same behavior for the end of the table.

I am doing this on a high bandwidth database, how do I avoid breaking everything with Read/Write locks?

Queries generated by the DBRO do not modify the DB, and I've added the "LOCK=NONE" to the queries, so you can avoid those pesky locks

Can it run queries on it's own?

Not now. But that's coming in the near future

Does it work with PostgreSQL?

Not yet. Maybe one day.

DBRO broke my production server, my company went bankrupt and my cat left me.

Whoops.

How do I get you to fix a bug/implement a new thing into DBRO?

Make an issue or PR. I'll see what can be done.

Why are you not copying the SCHEMA into another table, reordering it, and and then moving the data into the new reordered table?

It's a possibility, but that'll seriously screw with large tables. Cos it's gonna lock them up until the data is transferred from table A to table B. Will it be much faster? Yes. But I prefer not taking my DBs down.
But one day, I'll add this as an option.

Is this really the most useless FAQ?

Yes.

About

Tool to Reorder MySQL columns

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published