[GH-ISSUE #124] orm:schema-tool:create only creates domain_admins #95

Closed
opened 2026-02-26 09:35:49 +03:00 by kerem · 14 comments
Owner

Originally created by @petershaw on GitHub (Jan 20, 2015).
Original GitHub issue: https://github.com/opensolutions/ViMbAdmin/issues/124

Hi,
i run ./bin/doctrine2-cli.php orm:schema-tool:create, but only one table is created.
The Webinterfaice failes with:

File
/usr/local/vimbadmin/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php
Line
103
Message
An exception occurred while executing 'SELECT COUNT(a0_.id) AS sclr_0 FROM admin.admin a0_': SQLSTATE[42000]: Syntax error or access violation: 1142 SELECT command denied to user 'vimbadmin'@'localhost' for table 'admin'
Code
0

I am using debian, with php PHP 5.4.36-0+deb7u3

Validate seems to be ok:

root@c4ba9180f503:/usr/local/vimbadmin# bin/doctrine2-cli.php orm:validate-schema
[Mapping]  OK - The mapping files are correct.
[Database] OK - The database schema is in sync with the mapping files.

But this is my schema:

mysql> show tables;
+---------------------+
| Tables_in_vimbadmin |
+---------------------+
| domain_admins       |
+---------------------+
1 row in set (0.00 sec)

How to install necessary tables?

Originally created by @petershaw on GitHub (Jan 20, 2015). Original GitHub issue: https://github.com/opensolutions/ViMbAdmin/issues/124 Hi, i run ./bin/doctrine2-cli.php orm:schema-tool:create, but only one table is created. The Webinterfaice failes with: ``` File /usr/local/vimbadmin/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php Line 103 Message An exception occurred while executing 'SELECT COUNT(a0_.id) AS sclr_0 FROM admin.admin a0_': SQLSTATE[42000]: Syntax error or access violation: 1142 SELECT command denied to user 'vimbadmin'@'localhost' for table 'admin' Code 0 ``` I am using debian, with php PHP 5.4.36-0+deb7u3 Validate seems to be ok: ``` root@c4ba9180f503:/usr/local/vimbadmin# bin/doctrine2-cli.php orm:validate-schema [Mapping] OK - The mapping files are correct. [Database] OK - The database schema is in sync with the mapping files. ``` But this is my schema: ``` mysql> show tables; +---------------------+ | Tables_in_vimbadmin | +---------------------+ | domain_admins | +---------------------+ 1 row in set (0.00 sec) ``` How to install necessary tables?
kerem closed this issue 2026-02-26 09:35:49 +03:00
Author
Owner

@ghost commented on GitHub (Jan 20, 2015):

yah, i have the same problem :/

<!-- gh-comment-id:70664827 --> @ghost commented on GitHub (Jan 20, 2015): yah, i have the same problem :/
Author
Owner

@petershaw commented on GitHub (Jan 20, 2015):

Thank you very much.

<!-- gh-comment-id:70675076 --> @petershaw commented on GitHub (Jan 20, 2015): Thank you very much.
Author
Owner

@barryo commented on GitHub (Jan 20, 2015):

😄

<!-- gh-comment-id:70676450 --> @barryo commented on GitHub (Jan 20, 2015): :smile:
Author
Owner

@feaber commented on GitHub (Feb 1, 2015):

I still have same error.
Does this fix 6bef0bbaec work for You?

<!-- gh-comment-id:72383469 --> @feaber commented on GitHub (Feb 1, 2015): I still have same error. Does this fix 6bef0bbaec8ec68bab24ae251c304824f8869429 work for You?
Author
Owner

@feaber commented on GitHub (Feb 1, 2015):

Ok, so the database have to be named 'vimbadmin'.
If You use other db name, You will end up with error described by petershaw.

Not sure but still looks like issue here.

<!-- gh-comment-id:72386037 --> @feaber commented on GitHub (Feb 1, 2015): Ok, so the database **have to** be named 'vimbadmin'. If You use other db name, You will end up with error described by petershaw. Not sure but still looks like issue here.
Author
Owner

@barryo commented on GitHub (Feb 2, 2015):

Ok, so the database have to be named 'vimbadmin'.

It probably didn't until this fix. Reopening to allow for differently named databases when I have a chance.

<!-- gh-comment-id:72413157 --> @barryo commented on GitHub (Feb 2, 2015): > Ok, so the database have to be named 'vimbadmin'. It probably didn't until this fix. Reopening to allow for differently named databases when I have a chance.
Author
Owner

@barryo commented on GitHub (Feb 2, 2015):

Comment added to installation instructions also.

<!-- gh-comment-id:72413291 --> @barryo commented on GitHub (Feb 2, 2015): [Comment](https://github.com/opensolutions/ViMbAdmin/wiki/Installation#database-setup) added to installation instructions also.
Author
Owner

@eXistenZNL commented on GitHub (Apr 30, 2015):

The problem is that every Doctrine schema XML has schema="vimbadmin" in the entity element.

A quick workaround is:

$ cd doctrine2/xml
$ sed -i 's/schema="vimbadmin"//g' *

This removes the schema from Doctrine, which gets it working again. The SQL changes can be inspected by adding --dump-sql at the end of the doctrine command like so:

./bin/doctrine2-cli.php orm:schema-tool:create --dump-sql

This is also the proper long term fix as far as I can see it, the Doctrine XML's should not be locked to a specific database. Although I am not sure if it's a Doctrine requirement, I am no Doctrine superhero.

Make sure you drop any existing table before re-running the Doctrine DB setup commando, I find it easier to just drop and create the specified DB again from the MySQL / MariaDB console.

@barryo Maybe this can be added to the installation docs for the time being.

<!-- gh-comment-id:97731059 --> @eXistenZNL commented on GitHub (Apr 30, 2015): The problem is that every Doctrine schema XML has schema="vimbadmin" in the entity element. A quick workaround is: ``` $ cd doctrine2/xml $ sed -i 's/schema="vimbadmin"//g' * ``` This removes the schema from Doctrine, which gets it working again. The SQL changes can be inspected by adding --dump-sql at the end of the doctrine command like so: ``` ./bin/doctrine2-cli.php orm:schema-tool:create --dump-sql ``` This is also the proper long term fix as far as I can see it, the Doctrine XML's should not be locked to a specific database. Although I am not sure if it's a Doctrine requirement, I am no Doctrine superhero. Make sure you drop any existing table before re-running the Doctrine DB setup commando, I find it easier to just drop and create the specified DB again from the MySQL / MariaDB console. @barryo Maybe this can be added to the installation docs for the time being.
Author
Owner

@laapsaap commented on GitHub (May 4, 2015):

Seriously, in the 15 years that I have worked with PHP; this is the first time I seen a bug where you cannot change the database name. Is this what we get for adding so much more complexity in the frameworks ? Anyways this bug is really annoying because you just dont expect it. But fix above worked ^^ Thanks

<!-- gh-comment-id:98884834 --> @laapsaap commented on GitHub (May 4, 2015): Seriously, in the 15 years that I have worked with PHP; this is the first time I seen a bug where you cannot change the database name. Is this what we get for adding so much more complexity in the frameworks ? Anyways this bug is really annoying because you just dont expect it. But fix above worked ^^ Thanks
Author
Owner

@barryo commented on GitHub (May 5, 2015):

@laapsaap - nothing to do with the framework I imagine but rather a particular version of the tool we used to create the schema (Skipper). I haven't confirmed this but I suspect it is this.

<!-- gh-comment-id:98962083 --> @barryo commented on GitHub (May 5, 2015): @laapsaap - nothing to do with the framework I imagine but rather a particular version of the tool we used to create the schema (Skipper). I haven't confirmed this but I suspect it is this.
Author
Owner

@liayn commented on GitHub (May 27, 2015):

@eXistenZNL Thanks a lot, this resolved #138.

$ cd doctrine2/xml
$ sed -i 's/schema="vimbadmin"//g' *
$ cd ../../
$ bin/doctrine2-cli.php orm:generate-entities application/
$ bin/doctrine2-cli.php orm:generate-proxies application/
$ bin/doctrine2-cli.php orm:generate-repositories application/
<!-- gh-comment-id:106100832 --> @liayn commented on GitHub (May 27, 2015): @eXistenZNL Thanks a lot, this resolved #138. ``` $ cd doctrine2/xml $ sed -i 's/schema="vimbadmin"//g' * $ cd ../../ $ bin/doctrine2-cli.php orm:generate-entities application/ $ bin/doctrine2-cli.php orm:generate-proxies application/ $ bin/doctrine2-cli.php orm:generate-repositories application/ ```
Author
Owner

@eXistenZNL commented on GitHub (May 28, 2015):

@liayn You're welcome :)

<!-- gh-comment-id:106206526 --> @eXistenZNL commented on GitHub (May 28, 2015): @liayn You're welcome :)
Author
Owner

@mfechner commented on GitHub (May 28, 2015):

Thanks for this, I added it to my fork that includes also some other modifications I require.
https://github.com/idefix6/ViMbAdmin

<!-- gh-comment-id:106224673 --> @mfechner commented on GitHub (May 28, 2015): Thanks for this, I added it to my fork that includes also some other modifications I require. https://github.com/idefix6/ViMbAdmin
Author
Owner

@klonos commented on GitHub (Oct 21, 2015):

Sorry to resurrect this, but is this still an issue? Asking because this issue is linked from the installation documentation -> DB setup.

<!-- gh-comment-id:149908571 --> @klonos commented on GitHub (Oct 21, 2015): Sorry to resurrect this, but is this still an issue? Asking because this issue is linked from [the installation documentation -> DB setup](https://github.com/opensolutions/ViMbAdmin/wiki/Installation#database-setup).
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ViMbAdmin-opensolutions#95
No description provided.