<commit_before>package db.migration;

import net.unit8.bouncr.util.PasswordUtils;
import org.flywaydb.core.api.migration.jdbc.JdbcMigration;
import org.jooq.DSLContext;
import org.jooq.impl.DSL;

import java.sql.*;
import java.util.Arrays;

import static org.jooq.impl.DSL.*;

public class V998__BackChannelingTestData implements JdbcMigration {
    private static final String[] ADMIN_PERMISSIONS = new String[]{
            "create-board", "read-board", "modify-board",
            "create-thread", "read-any-thread", "read-thread", "write-any-thread", "write-thread",
            "add-watcher", "remove-watcher",
            "read-any-comment", "delete-any-comment", "delete-comment"
    };

    private static final String[] OTHER_PERMISSIONS = new String[]{
            "read-board",
            "create-thread", "read-thread", "write-thread",
            "add-watcher", "remove-watcher",
            "delete-comment"
    };

    private Long fetchGeneratedKey(PreparedStatement stmt) throws SQLException {
        try (ResultSet rs = stmt.getGeneratedKeys()) {
            while (rs.next()) {
                return rs.getLong(1);
            }
            throw new SQLException("Generated key is not found.");
        }
    }

    @Override
    public void migrate(Connection connection) throws Exception {
        DSLContext create = DSL.using(connection);
        final String INS_USER = create
                .insertInto(table("users"))
                .columns(
                        field("account"),
                        field("name"),
                        field("email"),
                        field("write_protected"))
                .values(param(), param(), param(), param())
                .getSQL();

        final String INS_PASSWD_CRED = create
                .insertInto(table("password_credentials"))
                .columns(<commit_msg>Delete old permission. create-thread -> write-thread, add-watcher -> read-thread, remove-watcher -> read-thread, read-any-comment -> read-any-permission.<commit_after>package db.migration;

import net.unit8.bouncr.util.PasswordUtils;
import org.flywaydb.core.api.migration.jdbc.JdbcMigration;
import org.jooq.DSLContext;
import org.jooq.impl.DSL;

import java.sql.*;
import java.util.Arrays;

import static org.jooq.impl.DSL.*;

public class V998__BackChannelingTestData implements JdbcMigration {
    private static final String[] ADMIN_PERMISSIONS = new String[]{
            "create-board", "read-board", "modify-board",
            "read-any-thread", "read-thread", "write-any-thread", "write-thread",
            "delete-any-comment", "delete-comment"
    };

    private static final String[] OTHER_PERMISSIONS = new String[]{
            "read-board",
            "read-thread", "write-thread",
            "delete-comment"
    };

    private Long fetchGeneratedKey(PreparedStatement stmt) throws SQLException {
        try (ResultSet rs = stmt.getGeneratedKeys()) {
            while (rs.next()) {
                return rs.getLong(1);
            }
            throw new SQLException("Generated key is not found.");
        }
    }

    @Override
    public void migrate(Connection connection) throws Exception {
        DSLContext create = DSL.using(connection);
        final String INS_USER = create
                .insertInto(table("users"))
                .columns(
                        field("account"),
                        field("name"),
                        field("email"),
                        field("write_protected"))
                .values(param(), param(), param(), param())
                .getSQL();

        final String INS_PASSWD_CRED = create
                .insertInto(table("password_credentials"))
                .columns(
{'fraction_non_alphanumeric': 0.12219850586979722, 'fraction_numerical': 0.0026680896478121665, 'mean_word_length': 2.1346153846153846, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5393914', 'n_tokens_mistral': 1038, 'n_tokens_neox': 992, 'n_words': 218}