liuyang1520 / django-command-extensions

Automatically exported from code.google.com/p/django-command-extensions
MIT License
0 stars 0 forks source link

Proposal : sqldiff --sql #44

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hi all

I noticed the sqldiff command today I thought it would be easy to plug a
--output-sql option to it, attached file is a patch that add this
functionality.

Notes : 
-The patch is quite long since I've moved some of the code around.
-I think it will be necessary to re factor a bit, I thought of a
--commit--change--and--yes--Im--sure option, that would imply a method that
returns the SQL as plain text (without styles), and the current code is not
able to do that.
-Maybe separating the retrieval of table_name, att_name, db_field_type,
model_type, and field and the actual output (be it fulltext or sql) would
be a good start
-I suck at naming function, properties, key etc...

Original issue reported on code.google.com by SamoriGo...@gmail.com on 26 Aug 2008 at 9:55

Attachments:

GoogleCodeExporter commented 8 years ago
PS : The differences outputted assume that the application is model-driven, 
which
mean all operations are done from the model to the database.

Original comment by SamoriGo...@gmail.com on 26 Aug 2008 at 10:04

GoogleCodeExporter commented 8 years ago
Argh, just notice this is not correct patch.
Please see attached file for the correct one.

Original comment by SamoriGo...@gmail.com on 26 Aug 2008 at 10:34

Attachments:

GoogleCodeExporter commented 8 years ago

Original comment by v.oostv...@gmail.com on 28 Aug 2008 at 1:08

GoogleCodeExporter commented 8 years ago

Original comment by v.oostv...@gmail.com on 28 Aug 2008 at 1:08

GoogleCodeExporter commented 8 years ago
added sql patch from SamoriGorse fixed issue #44
side note, i'm still hoping to have the time to rewrite sqldiff before 1.0.
the command itself will not change but the code could (and should) be much 
cleaner
and seperates out the logic for finding differences and printing them. (in 
text/sql
or other form)

Original comment by v.oostv...@gmail.com on 28 Aug 2008 at 3:23

GoogleCodeExporter commented 8 years ago
btw you don't need the --commit--change--and--yes--Im--sure option i think. if 
you
pipe the output to a file or to the database it should work without any 
problems.

(ofcourse at the moment the big fat warning in front of the output will 
generate some
sql exceptions)

Original comment by v.oostv...@gmail.com on 28 Aug 2008 at 3:24

GoogleCodeExporter commented 8 years ago
From comment 5 :

> the command itself will not change but the code could (and should) be much 
cleaner
> and seperates out the logic for finding differences and printing them. (in 
text/sql
> or other form)

I totally agree, the way the output is done at the moment is way to hacky.

From comment 6 :

> if you pipe the output to a file or to the database it should work without any
> problems.

I tried that yesterday, works fine.

>(ofcourse at the moment the big fat warning in front of the output will 
generate 
> some sql exceptions)

I guess a double dash instead of a hash would work.

Original comment by SamoriGo...@gmail.com on 28 Aug 2008 at 3:45