question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add the ability to show the sql generated by a migration

See original GitHub issue

It should be good to add a command which helps to show the SQL generated by a migration. This feature is something special for Django. I like Laravel but I don’t see anything like this when I need to show the SQL of a migration.

Example:

masonite-orm sqlmigration migration_for_users_table

Output:

BEGIN;
CREATE TABLE users (
    id serial NOT NULL PRIMARY KEY,
   name varchar(150) NOT NULL
);
COMMIT;

You can check for Django using the link below https://docs.djangoproject.com/en/3.1/ref/django-admin/#django-admin-sqlmigrate

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
josephmancusocommented, Oct 24, 2020

You should be able to pass the dry parameter and then inside the schema class see if dry is set and then just print to_sql()

0reactions
josephmancusocommented, Oct 24, 2020

Depends on how you are running the commands. You can also add it to the orm.py file and run it as “python orm your:command”

Read more comments on GitHub >

github_iconTop Results From Across the Web

Show SQL generated by pending migrations in rails without ...
Very interesting question! I found this way: Assume your migration placed in file db/migrate/20160102210050_create_items.rb and called ...
Read more >
Applying Migrations - EF Core - Microsoft Learn
The recommended way to deploy migrations to a production database is by generating SQL scripts. The advantages of this strategy include the ...
Read more >
Generating migrations in SSMS - SQL Change Automation 4
1. Make a change to the database · 2. Navigate to the Generate migrations page · 3. Optionally, filter the migrations · 4....
Read more >
3 Ways to View and Log the SQL Generated by Entity ...
Here's a way that you can log the SQL generated from EF Core 5. Add the method LogTo() where you've configured Entity Framework...
Read more >
Generating SQL Scripts (a.k.a. “Offline Mode”)
A major capability of Alembic is to generate migrations as SQL scripts, ... TABLE account ADD COLUMN last_transaction_date TIMESTAMP WITHOUT TIME ZONE; ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found