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

Added ExtraValueCommand #424

Merged
merged 6 commits into from
Nov 15, 2021
Merged

Added ExtraValueCommand #424

merged 6 commits into from
Nov 15, 2021

Conversation

MertUnverdi
Copy link
Member

No description provided.

@MertUnverdi MertUnverdi requested review from dlsf and PeachesMLG and removed request for dlsf October 3, 2021 21:50
@MertUnverdi MertUnverdi self-assigned this Oct 3, 2021
@dlsf
Copy link
Member

dlsf commented Oct 3, 2021

I don't like the idea of this command. What would be an actual use case? I can just think of dumb pay2win stuff.

@Faun471
Copy link
Contributor

Faun471 commented Oct 3, 2021

I don't like the idea of this command. What would be an actual use case? I can just think of dumb pay2win stuff.

Add could be used for rewards, remove could be used to punish players, set could be used for moderation.

This could be used for dumb p2w stuff, but this is way too useful for dum server owners that don't know how to use mysql xD

@dlsf dlsf added the enhancement New feature or request label Oct 4, 2021
@PeachesMLG
Copy link
Member

We dont have a way to alter databases atm, thats also why #389 hasnt been merged yet

@MertUnverdi
Copy link
Member Author

@dlsf any way for alter databases?

@dlsf
Copy link
Member

dlsf commented Nov 12, 2021

Yeah, I can do it

@MertUnverdi
Copy link
Member Author

waiting for u <3

try {
double amount = Double.parseDouble(args[3]);
switch (args[1].toUpperCase(Locale.ENGLISH)) {
case "ADD":
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use SubCommands

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nevermind, thats dum

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was about to say the same... But I don't know, it would be a very small subcommand.

I can do a subcommand PR soon that adds subcommands for the other commands too.

ALTER TABLE islands MODIFY name VARCHAR(512) NULL
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whats this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did it, just added a newline because they are important

@@ -0,0 +1 @@
ALTER TABLE islands ADD COLUMN extra_value DOUBLE PRECISION;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldnt this be called _mysql? and where is the sqllite version?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works for both MySQL and SQLite. The two different patches for MySQL and SQLite are optional

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SQLite doenst have the ALTER TABLE stuff though does it?
isnt that why we added the whole two different systems?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and why we had to do this mess for island names?

CREATE TEMPORARY TABLE islands_backup(id, name, home, visit, create_time, experience, color);
INSERT INTO islands_backup SELECT id, name, home, visit, create_time, experience, color FROM islands;
DROP TABLE islands;
CREATE TABLE islands(`id` INTEGER PRIMARY KEY AUTOINCREMENT , `name` VARCHAR , `home` VARCHAR , `visit` BOOLEAN , `create_time` BIGINT , `experience` INTEGER , `color` VARCHAR NOT NULL ,  UNIQUE (`name`));
INSERT INTO islands SELECT id, name, home, visit, create_time, experience, color FROM islands_backup;
DROP TABLE islands_backup;

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because creating tables works differently, I guess? The syntax checker said it's not possible

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Im confused? We are adding a new collum into the table, ALTER TABLE keyword doesnt work for sqllite, and I just tested it, this doesnt work. We need to do what we did for IslandNames

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SQLite also has certain ALTER TABLE statements: https://www.sqlite.org/lang_altertable.html

CREATE UNIQUE INDEX island_warps_id_name_island_id_uindex ON island_warps (id, name, island_id);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whats this aswell?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need more newlines

@PeachesMLG PeachesMLG merged commit a45eed2 into master Nov 15, 2021
@PeachesMLG PeachesMLG deleted the feature/extravalue branch November 15, 2021 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants