PermissionsEx

PermissionsEx

14M Downloads

Unknown column 'prefix' in 'field list'

SilverJow opened this issue ยท 8 comments

commented

Hello, i cleared my PEX tables and i created a new permissions node, the permissions are working properly but the prefixes aren't working on some servers, i get this error log:
03:20:09] [pool-16-thread-1/ERROR]: [PermissionsEx] Error occurred with PermissionsEx! Please post it to http://git.io/You are being redirected.. Full error:
ru.tehkode.permissions.exceptions.PermissionBackendException: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'prefix' in 'field list'
at ru.tehkode.permissions.backends.sql.SQLBackend$3.performUpdate(SQLBackend.java:186)
at ru.tehkode.permissions.backends.PermissionBackend.performSchemaUpdate(PermissionBackend.java:90)
at ru.tehkode.permissions.backends.sql.SQLBackend.(SQLBackend.java:192)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at ru.tehkode.permissions.backends.PermissionBackend.getBackend(PermissionBackend.java:392)
at ru.tehkode.permissions.backends.PermissionBackend.getBackend(PermissionBackend.java:367)
at ru.tehkode.permissions.PermissionManager.createBackend(PermissionManager.java:624)
at ru.tehkode.permissions.PermissionManager.setBackend(PermissionManager.java:606)
at ru.tehkode.permissions.PermissionManager.initBackend(PermissionManager.java:693)
at ru.tehkode.permissions.PermissionManager.(PermissionManager.java:67)
at ru.tehkode.permissions.bukkit.PermissionsEx.onEnable(PermissionsEx.java:175)
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:271)
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:337)
at com.massivecraft.massivelag.inject.MassiveLagPluginLoader.enablePlugin(MassiveLagPluginLoader.java:215)
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:405)
at org.bukkit.craftbukkit.v1_11_R1.CraftServer.enablePlugin(CraftServer.java:376)
at org.bukkit.craftbukkit.v1_11_R1.CraftServer.enablePlugins(CraftServer.java:326)
at net.minecraft.server.v1_11_R1.MinecraftServer.t(MinecraftServer.java:421)
at net.minecraft.server.v1_11_R1.MinecraftServer.l(MinecraftServer.java:382)
at net.minecraft.server.v1_11_R1.MinecraftServer.a(MinecraftServer.java:337)
at net.minecraft.server.v1_11_R1.DedicatedServer.init(DedicatedServer.java:272)
at net.minecraft.server.v1_11_R1.MinecraftServer.run(MinecraftServer.java:544)
at java.lang.Thread.run(Thread.java:745)
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'prefix' in 'field list'
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)
at com.mysql.jdbc.Util.getInstance(Util.java:408)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:943)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3970)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3906)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2524)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2677)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2549)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1861)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1962)
at ru.tehkode.libs.org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:96)
at ru.tehkode.libs.org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:96)
at ru.tehkode.permissions.backends.sql.SQLBackend$3.performUpdate(SQLBackend.java:161)
... 25 more
How can i fix this?
Thanks for the support

commented

I don't handle SQL errors, but I think the solution is to look through your database and you'll find you have 2 "schema-version: 1" lines. Delete one and everything should be fine.

commented

There is not a schema-version: 1 on the database, i searched very well, believe me ๐Ÿ˜ž

commented

Then add one. ;-)

There should be one.

When you import your permissions.yml file to the database, the schema-version: 1 line which belongs in the pex file goes into the database.

So, if your file was messed up from the beginning and you didn't have a schema line, there's your problem. ;-)

commented

I fixed the problem by myself, thank you ...

commented

@Stormbow I would like to know if there's a permission to deny a user use the command /pex
For example: i want to give a friend all the permissions, with /pex user Nick add *
but i also would like to deny him to use tthe command /pex

commented

I fixed the problem by myself, thank you ...

No one pointed you in the right direction. Eh?

users:
  XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX:
    options:
      name: Nick
    group:
    - TheirGroupNameHere
    permissions:
    - -permissions.*
    - '*'

The wildcard - '*' will give them access to all other plugins on the server, including the power to change those plugin's settings completely.

commented

Well, you are right, you pointed me in the right direction, but i tried over 2 hours different ways to fix the problem, and now i want to share this because maybe could help someone having the same problem than mine:
The problem of Unknown column 'prefix' in 'field list' can be fixed if you follow this steps:
First let's suppose that you have a mysql database like this:
INSERT INTO permissions (id, name, type, permission, world, value) VALUES
(1, 'VIP, 0, 'prefix', '', '&c[V]'),
(2, 'VIP', 0, 'permission.1, '', ''),
(3, 'VIP', 0, 'permission.2', '', ''),
(4, 'VIP', 0, 'permission.3', '', ''),
....
To fix this is just add the following line and change some ids:
INSERT INTO permissions (id, name, type, permission, world, value) VALUES
(1, 'system', 2, 'schema_version', '', '2'),
(2, 'VIP, 0, 'prefix', '', '&c[V]'),
(3, 'VIP', 0, 'permission.1, '', ''),
(4, 'VIP', 0, 'permission.2', '', ''),
(5, 'VIP', 0, 'permission.3', '', ''),
....
I just want to say thank you for the support, and i hope that this can help someone

commented

I have no idea what you just said, but it looks SQL-ish, soโ€” awesome and thanks for sharing the solution! :-)