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

it only gives me null values #1

Open
Ygilany opened this issue Sep 10, 2017 · 2 comments
Open

it only gives me null values #1

Ygilany opened this issue Sep 10, 2017 · 2 comments

Comments

@Ygilany
Copy link

Ygilany commented Sep 10, 2017

image

@huyphams
Copy link
Contributor

@Ygilany are you using MySQL?
plugin is still under development, it's null because it doesn't handle correct data type. You can take a look at source code
https://github.com/TablePlus/DummiesData/blob/master/DummiesData.tableplusplugin/library/helper.js

  // Random value
    keys.forEach(function(key) {
        var dataType = columns[key]['typeString'];
        if (dataType == 'varchar' || dataType == 'text') {
            var sentence = randomSentence();
            row.update(key, sentence);
            row.setDefault(key, 0);
        }
        if ((dataType == 'int4' || dataType == 'int8') && !primary.includes(key)) {
            var number = Math.floor(Math.random() * 1000000);
            row.update(key, number);
            row.setDefault(key, 0);
        }
        if (dataType == 'timestamp') {
            var t = new Date();
            var formatted = t.toISOString();
            row.update(key, formatted);
            row.setDefault(key, 0);
        }
        if (dataType == 'bool') {
            if (Math.random() >= 0.5) {
                row.update(key, 't');
            } else {
                row.update(key, 'f');
            }
            row.setDefault(key, 0);
        }
    });

I will improve this source with better quote and support full data type: PostgreSQL, MySQL, SQLite, MS SQL...

@zuzhang
Copy link

zuzhang commented Nov 15, 2023

Hi @huyphams Is there any plan to release this plugin? It would be great help if there is a built-in plugin to generate test data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants