I have a custom module and just created a content entity using drupal generate:entity:content.
Played a bit with it, and deleted table from PHPMyAdmin.
Now, I am unable to recover it back, I tried to create table again, but drush updatedb --entity-updates does not help to get table back in shape. Looks like table metadata lives somewhere else.
How can I rebuild the table?
UPDATE:
Achieved by reinstalling the module. Please share if there is a better way to do it.
I can't uninstall the module because base table not found error.
drupal update:entities
This command creates the missing entity table for me.
Related
Forgive me if this is a silly question, just been scratching my head for hours on this and cannot find a decent answer!
I'm writing a script to install a Laravel CMS to a database and would like to have it create the database from the given name if it does not exist.
I am at the stage where the system understands that the database does not exist and so needs to create it, But every time I run my code I get the exception:
SQLSTATE[HY000] [1049] Unknown database 'mytesting' (SQL: CREATE DATABASE mytesting)
I'm running the code as follows to initiate the database creation:
DB::statement(DB::raw('CREATE DATABASE '.$_POST['DbDatabase']));
Now, I can understand that this may be crashing because the database name set in the .env is that of a database that is yet to exist, but I am wondering if there is a way to have the system simply auth to MySQL via login (No db name specified) and then create the table?
I've run the provided sql inside Sequel pro and it works there so I know it's valid, But am confused all the same!
If any yall could shine some light on this I'd be eternally grateful!
Thanks guys <3
I finally managed to figure out a way around this!
So instead of using Laravel's DB manager I ended up using a PDO instance instead as I could control what it did at a much more granular level. I specified the connection details out of the env file.
Thanks so much for your help guys <3
I've taken over control of a rails project, however before I took the lead it was kind of just being handled by a semi-technical manager but not someone who knows rails. In this time they realized that they needed to add some tables/rows to the database, to do this they simply added them through MySQL and didn't create any migrations for them. When I first took over I added the migrations for those tables/rows so I could have them locally.
The issue is when I try to run the migrations on the staging/production severs which had the tables added manually through MySQL the migration fails(because the migrations I added to have the updated tables/rows locally crashes due them already existing). This hasn't been an issue but I would like to now add a migration for an entirely new table, but because of the old ones crashing since the tables already exist, this migration never gets ran.
To my knowledge the only way to fix this would be to drop the tables and then re-add them with the migrations I wrote. The reason I'm unsure to do that is I'd lose all the data in those tables which can't happen. There's probably a way to backup the data and reload it after I drop the tables and re-add them but I've never done that before so wouldn't know where to start. Alternatively I could manually update the DB in MySQL to add the new table I want and just keep the migrations for local but that seems really hacky and defeats the purpose of using them.
So, any ideas?
Rails uses schema_migrations table to keep track of the migrations that are already run. It has one column called version that the last run migration's number.
select * from schema_migrations;
One way is to update this table to the migration number that has the changes already applied to the database
I have installed a new theme called Express (pt_express) from Magento and I am having issues. I keep getting "There is a problem with the reindexing process" when I go to reindex all the files there. The one called "PT Express" (that got created when I made the theme) is the one that cannot be reindexed. When I tried to do it via SSH I got this:
PT Filter index process unknown error:
exception 'PDOException' with message 'SQLSTATE[42S02]: Base table or view not
found: 1146 Table 'justind1_direct.filter_attribute_url_key' doesn't exist'
in /home/justind1/public_html/lib/Zend/Db/Statement/Pdo.php:228
However, everything else indexed fine.
I looked in phpMyAdmin and I know the table isn't there, but I don't know how to create it. How do I create this table so it exists?
The table
`filter_attribute_url_key`
is not part of any stock magento system I've heard of. That, plus the fact that googling for that table name only brings up this ticket, point to this table (and problem) being
Part of a module that came with your theme
Part of some custom code you have on your system that's interacting poorly with the code that came with your them
I'd look at the modules that came with your theme -- particularly the sql folder. These contain setup resource files (migrations) that should automatically run if you load Magento with an empty cache. That's normally how modules add new needed tables.
You also might try asking your vendor for support.
Without more research you're unlikely to find an answer here, given the very specific nature of the problem and the known state of your specific system.
how to see my liferay table in mysql database?
i have created portal-ext.properties in liferay home.but i cant see my liferey table mySql..
table is created in docroot/web-inf/sql in eclipse IDE...
help me where i m wrong and which thing missing?
#
# MySQL
#
include-and-override=portal-ext.properties
include-and-override=${liferay.home}/portal-ext.properties
jdbc.default.driverClassName=com.mysql.jdbc.Driver
jdbc.default.url=jdbc:mysql://localhost/kportal?useUnicode=true&characterEn
coding=UTF-8&useFastDateParsing=false
jdbc.default.username=root
jdbc.default.password=ubuntu123
schema.run.enabled=true
schema.run.minimal=true
Tables created through service-builder will only be created once you deploy your plugin to the actual server (and run the server), not on build time. Also, your plugin needs to deploy correctly - if initialization fails (e.g. due to missing pieces or dependencies that are not met), the tables will not be created.
Also, the tables by default will be named with the namespace you gave as a prefix. So if you declare a namespace X (in service.xml) and an entity named Y, the table to look for will be named X_Y.
Also, remember you'll have to run ant build-services after you edited your service.xml. Then deploy it and wait for a log message similar "...your plugin... is available for use" to be sure it deployed correctly. (Edit: This is no longer printed for portlets, only for the other plugin types, so you might not see it when you deployed your plugin)
If this doesn't help, please give more information. Currently you don't give any details about what you've actually tried. You'll find more steps and details on the development guide.
Also, make sure
that the account you use for the database has CREATE TABLE permissions (you use root in your configuration above - that should do the trick)
that you're checking the correct database in case you have multiple
that Liferay actually picks up your configuration file. The startup log will tell you which portal-ext.properties files are read, as well as which database it will use. In case you can't find the name/location of your portal-ext.properties file, make sure that you indeed have a file with this name. A common problem on windows is that people create portal-ext.properties.txt (and Windows hides the .txt part of the name)
Recently I started to use Linux (Ubuntu 9.10) instead of windows. I am working on a java web application with Spring, MYSQL with jpa. However, before to install linux I made a backup file from the database, then installed linux, installed the MYSQL Query Browser and Administrator tools, and using the Admin tool restored the backup file, then got all the tables and made a simple select statement from one of the tables and got result normally and everything seems to work just fine.
There a USER table, and there's a namedQuery defined to get a user by userName, the problem is that when I pass a correct userName I still get nothing!
I really don't know what is the problem! The application was working perfectly under windows!
Please, can anyone help me to solve this problem?
Thank you in advance.
The first thing that comes to mind is that MySQL table names are case sensitive on Linux but not on Windows. i.e. this might have worked on Windows:
SELECT ... FROM User ...
but on Linux you need to use the correct case for the table name:
SELECT ... FROM USER ...
but without more information it's really difficult to tell.
There are some settings that have different defaults under Windows and Linux, case sensitivity of table names etc. being one of them. It could be that a non-specified setting defaulted to one value on windows, but another under linux.
You're all right, and for my case I found out why wasn't I able to login passing the userName!
The problem is that when I restore schema from the backup file, all the tables are being created with lower case names, for example, the USER table would be user, then..
When I boot up tomcat, JPA creates automatically all the #Entity, therefore it creates a User tables for the #Entity User, the result is that I have two tables for USER, a user table which has all the data, and an empty User table, and this is the one that is used by the application! That's why I was not able to retrieve any data because actually there's no data to retrieve from the table.
A workaround to solve this problem I modified the backup file renaming all the tables as expected by JPA to avoid creating them again when booting up the application.
I really don't know if there's a better solution, but it worked like this for me.
Finally, thank you very much for your help.