-
-
Notifications
You must be signed in to change notification settings - Fork 261
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError on generate migration files #79
Comments
Hi @omidd1315 Thank you for reporting. Could you please provide the View SQL that you are trying to generate?
It seems the error is caused by the generator trying to generate I want to reproduce the error and check the root cause before adding the null check. |
Hello. I have the a very similar issue with MySQL connection. I'd tried generate all tables in DB excluding some and generate only one table, with the same result. As you can see, when I try to generate all tables, return message with the list of tables (it's reading OK DB), but fail with error below php artisan migrate:generate --ignore="users,password_resets,failed_jobs,personal_access_tokens,sessions" Generating migrations for: address, address_type, address_type_address, adidas_liq, aecoc, analytics, analytics_detail, analytics_groups, analytics_groups_ca, analytics_inputs, bagents, bagents_commissions, bagents_conditions, banks, banks_accounts, banks_accounts_companies, banks_accounts_movements, budgets, budgets_detail, budgets_detail_copy1, budgets_distribution, carriers, carriers_orders, carriers_services, carriers_states, carriers_suscribers, class_orders, companies, contable_accounts, contacts, countries, customers, customers_credit, customers_diposed, customers_payment, customers_webshops, document_sequentials, document_type, document_type_documents, documents_cancelled_products, employees, entities_files, errors_notifications, financial_companies, financial_rates, financial_rates_values, groups, issues, issues_lines, log_extractions_rules, log_locations, log_locations_blocked, log_products_assigned, log_spaces, log_spaces_types, log_stock_movements, log_stock_movements_products, log_stock_movements_types, log_workorders, log_workorders_products, log_workorders_products_details, log_workorders_types, logistics_actions, logs, logs_customerscredit, logs_directdebit, logs_methods, logs_wservices, maestro_adidas2021, media_borrar, menus, model_has_permissions, model_has_roles, notifications, notifications_recipients, notifications_smc, notifications_spooler, oauth_access_tokens, oauth_auth_codes, oauth_clients, oauth_personal_access_clients, oauth_refresh_tokens, pack, pack_contents, package_types, parameters, parameters_categories, paymenttype, paymenttype_web, permissions, powershop_formaspago, powershop_historico_stock, powershop_movimientos, powershop_movimientos_alb, powershop_movimientos_old, powershop_msi, powershop_pagos, powershop_partidos, powershop_payments_type, powershop_sin_pagos, powershop_stock, powershop_temporadas, powershops_tickets, products, products_brands, products_canals, products_catalogs, products_catalogs_detail, products_compound, products_costs, products_families, products_genders, products_parent, products_parent_canals, products_parent_media, products_rates, products_rates_products, products_rates_products_history, products_seasons, products_sizes, products_sizes_groups, products_sizes_type, products_stock, products_stock_month, products_subfamilies, products_type, products_wac, products_wac_bak, products_wac_history, projects, projects_agrupations, projects_change, projects_copy1, projects_distribution, projects_distribution_detail, projects_distribution_detail_bak, projects_groups, projects_groups_stages, provinces, psp, purchase_invoices, purchase_invoices_products, purchase_invoices_products_dist, purchase_invoices_products_dist_bak, purchase_notes, purchase_notes_products, purchase_orders, purchase_orders_products, purchases_documents_payments, ranges, ranges_products, ranges_stores, role_has_permissions, roles, sales_budgets, sales_budgets_products, sales_documents_payments, sales_documents_payments_dist, sales_invoices, sales_invoices_products, sales_notes, sales_notes_bagents, sales_notes_products, sales_notes_shipments, sales_orders, sales_orders_bagents, sales_orders_canals, sales_orders_products, sales_tickets, sales_tickets_payments, sales_tickets_products, sec_b2b_catalogs, sec_companies, sec_customers, sec_documents, sec_groups, sec_logistics, sec_menus, sec_projects, sec_roles, sec_stores, sec_users_actions, shoppingcarts, shoppingcarts_products, states, states_detail, states_documents, states_register, states_register_detail, stores, stores_paymenttypes, stores_printers, stores_sm, suppliers, suppliers_payment, supply_notes, supply_notes_products, supply_orders, supply_orders_products, tax_types, thirdparties, tmp_sales_notes_import, towns, users_actions, users_signings, virtuals_w, warehouses, warehouses_suscribers, webshops, webshops_states, work_centers, workshops, worksorders, worksorders_attachments, worksorders_products, worksorders_types, products_view, sizes_view, stock_available_view, stock_in_process Do you want to log these migrations in the migrations table? (yes/no) [yes]: Next Batch Number is: 1. We recommend using Batch Number 0 so that it becomes the "first" migration [Default: 0] [0]:
Setting up Tables and Index Migrations TypeError Argument 1 passed to MigrationsGenerator\Generators\Blueprint\SchemaBlueprint::__construct() must be of the type string, null given, called in C:\Users\Roberto\Desarrollo\Web-GIT\smc-b2b\vendor\kitloong\laravel-migrations-generator\src\MigrationsGenerator\Generators\TableMigration.php on line 143 at C:\Users\Roberto\Desarrollo\Web-GIT\smc-b2b\vendor\kitloong\laravel-migrations-generator\src\MigrationsGenerator\Generators\Blueprint\SchemaBlueprint.php:33 1 C:\Users\Roberto\Desarrollo\Web-GIT\smc-b2b\vendor\kitloong\laravel-migrations-generator\src\MigrationsGenerator\Generators\TableMigration.php:143 2 C:\Users\Roberto\Desarrollo\Web-GIT\smc-b2b\vendor\kitloong\laravel-migrations-generator\src\MigrationsGenerator\Generators\TableMigration.php:41 |
I forget some data: |
Hi @rsimonru , thank you for reporting.
Do you have this issue if you try generation on a fresh new Laravel 8? use Illuminate\Support\Facades\DB;
// If your connection name is 'mysql'
DB::connection('mysql')->getName(); // Output: mysql In normal circumstances, the connection name is not
If you have the same issue I shall proceed with the same step to reproduce the error. |
Thanks. |
Hello, We're experiencing a similar issue as above. We have a read-only Laravel application that is for viewing data within a legacy database. We were attempting to generate migrations based on that database using this package. We only use a portion of the tables, and none of the existing views. So I thought using the I should also mention I had originally tried without using the Versions:
However, when I run
We're thinking to backup, remove the views entirely, and try again since they are no longer referenced at all. But wanted to add my additional info here in case it is needed to troubleshoot this further. Thanks! |
Hi @collinticer , thank you for the detailed explanation and I am sorry for my late reply. I am aware of this type error and the reason I keep this issue open is that I currently can't find a good way to fix the issue. This package has tight relation with I suspect the package has a different type definition in the previous version and that's why we are seeing this issue. Could you please provide the
I will proceed to the fix if I am able to find what is really going on with the type error. |
Hey @kitloong - thanks for looking into this! I've been able to get past this error by commenting out all the associated code dealing with views from Following is the version output of
Let me know what else you need from me. |
Hi @collinticer Thank you for providing the details, it helps a lot in my investigation. It turns out in I added All fixed above were released in Thank you for making this package better! |
The definition is NULL if encrypted Filter NULL value to always return view definition. https://docs.microsoft.com/en-us/sql/relational-databases/system-catalog-views/sys-sql-modules-transact-sql?view=sql-server-ver15
database.php
php artisan migrate:generate -c rwsn_sqlsrv
Using connection: rwsn_sqlsrv TypeError MigrationsGenerator\DBAL\Mapper\ViewMapper::makeView(): Argument #2 ($sql) must be of type string, null given, called in /var/www/html/server/niyam/vendor/kitloong/laravel-migrations-generator/src/MigrationsGenerator/DBAL/Mapper/ViewMapper.php on line 60 at vendor/kitloong/laravel-migrations-generator/src/MigrationsGenerator/DBAL/Mapper/ViewMapper.php:77 73▕ 74▕ /** 75▕ * @throws \Doctrine\DBAL\Exception 76▕ */ ➜ 77▕ private static function makeView(string $name, string $sql): View 78▕ { 79▕ // trim quotes 80▕ $unquotedName = str_replace(['`', '"', '[', ']'], '', $name); 81▕ +3 vendor frames 4 [internal]:0 MigrationsGenerator\DBAL\Schema::MigrationsGenerator\DBAL\{closure}() +18 vendor frames 23 artisan:37 Illuminate\Foundation\Console\Kernel::handle()
The text was updated successfully, but these errors were encountered: