Skip to content
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

Remove or ignore the 'id' column #38

Closed
wy10cheng opened this issue Jan 20, 2021 · 11 comments
Closed

Remove or ignore the 'id' column #38

wy10cheng opened this issue Jan 20, 2021 · 11 comments
Assignees
Labels
question Further information is requested

Comments

@wy10cheng
Copy link

Hello,

Can I remove or ignore the 'id' column of created casbin_rule table?
If so, where shall I edit? Since I don't see the 'id' field in your model.
Thanks.

@hsluoyz hsluoyz self-assigned this Jan 20, 2021
@hsluoyz hsluoyz added the question Further information is requested label Jan 20, 2021
@hsluoyz
Copy link
Member

hsluoyz commented Jan 20, 2021

@17bit

@rafaellech
Copy link

I am also facing the same issue, could you please help @17bit

@hsluoyz
Copy link
Member

hsluoyz commented Jan 21, 2021

@wy10cheng @rafaellech why don't just ignore the id field?

@wy10cheng
Copy link
Author

wy10cheng commented Jan 21, 2021

@wy10cheng @rafaellech why don't just ignore the id field?

since our team is using 2 adapters to write the table in different project. once the adapter with 'id' is built, the other project with JDBC adapter could not find the right table to match and raise error, and vice versa

@wy10cheng
Copy link
Author

@wy10cheng @rafaellech why don't just ignore the id field?

i had also found the code is without the part creating the column 'id', so also curious where does this primary key field come from

@17bit
Copy link

17bit commented Jan 21, 2021

@wy10cheng @rafaellech why don't just ignore the id field?

since our team is using 2 adapters to write the table in different project. once the adapter with 'id' is built, the other project with JDBC adapter could not find the right table to match and raise error, and vice versa

Could you send the error message? I guess it's Sequelize's problem.

@wy10cheng
Copy link
Author

@wy10cheng @rafaellech why don't just ignore the id field?

since our team is using 2 adapters to write the table in different project. once the adapter with 'id' is built, the other project with JDBC adapter could not find the right table to match and raise error, and vice versa

Could you send the error message? I guess it's Sequelize's problem.

Server is running on 5000
Executing (default): SELECT 1+1 AS result
Executing (default): CREATE TABLE IF NOT EXISTS `casbin_rule` (`id` INTEGER NOT NULL auto_increment , `ptype` VARCHAR(255), `v0` VARCHAR(255), `v1` VARCHAR(255), `v2` VARCHAR(255), `v3` VARCHAR(255), `v4` VARCHAR(255), `v5` VARCHAR(255), PRIMARY KEY (`id`)) ENGINE=InnoDB;
Executing (default): SHOW INDEX FROM `casbin_rule` FROM `dev`
Executing (default): SELECT `id`, `ptype`, `v0`, `v1`, `v2`, `v3`, `v4`, `v5` FROM `casbin_rule` AS `CasbinRule`;
(node:3016) UnhandledPromiseRejectionWarning: SequelizeDatabaseError: Unknown column 'id' in 'field list'
    at Query.formatError (/Users/michaelcheng/Documents/proj/casbin/casbin-role-backend/node_modules/sequelize/lib/dialects/mysql/query.js:244:16)
    at Query.handler [as onResult] (/Users/michaelcheng/Documents/proj/casbin/casbin-role-backend/node_modules/sequelize/lib/dialects/mysql/query.js:51:23)
    at Query.execute (/Users/michaelcheng/Documents/proj/casbin/casbin-role-backend/node_modules/mysql2/lib/commands/command.js:30:14)
    at Connection.handlePacket (/Users/michaelcheng/Documents/proj/casbin/casbin-role-backend/node_modules/mysql2/lib/connection.js:417:32)
    at PacketParser.onPacket (/Users/michaelcheng/Documents/proj/casbin/casbin-role-backend/node_modules/mysql2/lib/connection.js:75:12)
    at PacketParser.executeStart (/Users/michaelcheng/Documents/proj/casbin/casbin-role-backend/node_modules/mysql2/lib/packet_parser.js:75:16)
    at Socket.<anonymous> (/Users/michaelcheng/Documents/proj/casbin/casbin-role-backend/node_modules/mysql2/lib/connection.js:82:25)
    at Socket.emit (events.js:315:20)
    at addChunk (internal/streams/readable.js:309:12)
    at readableAddChunk (internal/streams/readable.js:284:9)
    at Socket.Readable.push (internal/streams/readable.js:223:10)
    at TCP.onStreamRead (internal/stream_base_commons.js:188:23)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:3016) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:3016) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

@17bit
Copy link

17bit commented Jan 21, 2021

@wy10cheng @rafaellech why don't just ignore the id field?

since our team is using 2 adapters to write the table in different project. once the adapter with 'id' is built, the other project with JDBC adapter could not find the right table to match and raise error, and vice versa

This is a bug because we do not define a primary key in casbinRule.ts.

@hsluoyz

@wy10cheng
Copy link
Author

@hsluoyz can you please help? thanks a lot

@hsluoyz
Copy link
Member

hsluoyz commented Jan 22, 2021

@wy10cheng actually our ultimate goal is to add the id column for all adapters.

So if you mean that the Node.js's sequelize-adapter creates the id column but the Java's JDBC adapter doesn't support or recognize it or the whole table, I think we should fix it at the JDBC adapter's side. Can you create a GitHub issue at the JDBC adapter's repo?

@hsluoyz
Copy link
Member

hsluoyz commented Jan 22, 2021

Replaced by: jcasbin/casbin-spring-boot-starter#21

@hsluoyz hsluoyz closed this as completed Jan 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants