Comments (6)
I would find it useful too.
I'm guessing that creating a Ruckusing_Adapter_Flatfile_Base
that extends Ruckusing_Adapter_Interface
and writes to a file would do the trick?
This would make ruckusing usable without requiring a live database connection.
from ruckusing-migrations.
Most of the plumbing is in place. When $conf['log_dir'] is specified than a $ENV.log file is generated which contains all SQL statements sent to the server.
However, this file is formatted with timestamps and contains all queries that also retrieve table information.
You want a log which ONLY contains DML statements (CREATE / DELETE / INSERT / UPDATE, etc) and have those sent to a file w/o any additional formatting, timestamps, etc.
So really the process would involve this:
- Create a new config option for "dml_statement_query_log" or something
- When running all SQL detect if its a DML statement: send to the dml_statement_query_log
All Adapters currently implement determine_query_type() (which should be added to the Base Adapter) which can be leveraged in #2 to determine if the query should be logged.
If you want to take a stab at this in a PR I would be very thankful.
On Aug 6, 2014, at 1:52 AM, C-Duv [email protected] wrote:
I would find it useful too.
I'm guessing that creating a Ruckusing_Adapter_Flatfile_Base that extends Ruckusing_Adapter_Interface and writes to a file would do the trick?—
Reply to this email directly or view it on GitHub.
from ruckusing-migrations.
When $conf['log_dir'] is specified than a $ENV.log file is generated which contains all SQL statements sent to the server.
So SQL statements goes to both server and log file?
from ruckusing-migrations.
As of now, yes, all SQL is logged to the log file.
But since it has other meta-data, such as timestamps and it contains all SELECT operations (e.g. fetching table info, etc) then its not exactly what you need.
On Aug 6, 2014, at 3:15 PM, C-Duv [email protected] wrote:
When $conf['log_dir'] is specified than a $ENV.log file is generated which contains all SQL statements sent to the server.
So SQL statements goes to both server and log file?
—
Reply to this email directly or view it on GitHub.
from ruckusing-migrations.
What I meant was: At current state, if I want to get all queries into a single "flat" file I can set $conf['log_dir']
but:
- File will contains DML and non-DML SQL statements
- SQL statements would still be sent to server: thus a live connection to the SQL server is required
You are suggesting to:
- add an option that define a file location where to write DML statements
- declare
determine_query_type()
intoRuckusing_Adapter_Base
(already present in implementedRuckusing_Adapter_*_Base
) - Modify
Ruckusing_Adapter_*_Base::query()
so that it writes DML to that DML-only file.
I was more like: create a new Ruckusing_Adapter_Base
(say Ruckusing_Adapter_Flatfile_Base
) whose dsn
is an array containing the file location.
But for the solution to be "offline" (no live connection to SQL server) we need a way to tell ruckusing the schema version starting point (since it cannot ask the server for that) when asking for SQL change statements (and default to version "0") right?
I'm just discovering ruckusing but once I've played with it a bit I can file a PR to answer this issue.
from ruckusing-migrations.
Yes, you got it.
I think trying to jigger it all around to work against a non-live server will be way too complex and outside the scope. Basically the whole framework queries the server to get all sorts of meta info about the tables / columns / indexes, etc.
So I stand by my original suggestion - which you have encapsulated below.
Thanks in advance for your contributions!
On Aug 6, 2014, at 4:00 PM, C-Duv [email protected] wrote:
What I meant was: At current state, if I want to get all queries into a single "flat" file I can set $conf['log_dir'] but:
File will contains DML and non-DML SQL statements
SQL statements would still be sent to server: thus a live connection to the SQL server is required
You are suggesting to:add an option that define a file location where to write DML statements
declare determine_query_type() into Ruckusing_Adapter_Base (already present in implemented Ruckusing_Adapter___Base)
Modify Ruckusing_Adapter___Base::query() so that it writes DML to that DML-only file.
I was more like: create a new Ruckusing_Adapter_Base (say Ruckusing_Adapter_Flatfile_Base) whose dsn is an array containing the file location.But for the solution to be "offline" (no live connection to SQL server) we need a way to tell ruckusing the schema version starting point (since it cannot ask the server for that) when asking for SQL change statements (and default to version "0") right?
I'm just discovering ruckusing but once I've played with it a bit I can file a PR to answer this issue.
—
Reply to this email directly or view it on GitHub.
from ruckusing-migrations.
Related Issues (20)
- Run migration through code HOT 1
- db:migrate throws exception if migrations dir is not writable HOT 3
- migrate_from_offset issue HOT 1
- Unable to execute query for trigger HOT 10
- DB connection issue when trying to setup Ruckusing Migrations - Abstract.php No Such File Or Directory HOT 4
- Error during migrations and rollbacks. "Reason: Commands out of sync; you can't run this command now" HOT 3
- Is it possible to execute the ruckusing-migration through http request HOT 4
- Is there any plan to have more details in schema_migrations table? HOT 1
- MySQL timestamp needs a NULL attribute when null == true
- how can i add auto_increment column to work with mysql and postgres databases? HOT 5
- FOREIGN KEY Constraint HOT 1
- Exception not properly thrown HOT 1
- Documentation for config file HOT 1
- CREATE INDEX CONCURRENTLY cannot run inside a transaction block
- Fatal error: Class 'mysqli' not found in /web/vendor/ruckusing/ruckusing-migrations/lib/Ruckusing/Adapter/MySQL/Base.php on line 1259 HOT 3
- Error:I dont know what column type of 'longtext' maps to for MySQL
- Roadmap: Integrate Percona Toolkit? HOT 1
- Use PSR LoggerInterface instead of Ruckusing_Util_Logger.
- Unable to connect via TLS for MySQL connections
- too many connections
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ruckusing-migrations.