Support from Acquia helps fund testing for Drupal Acquia logo

Comments

techtud created an issue. See original summary.

vidhatanand’s picture

JayKandari’s picture

Status: Needs review » Reviewed & tested by the community

3 instances of "db_create_table()" found in following Files:

core/includes/schema.inc:122:    db_create_table($name, $table);
core/scripts/dump-database-d6.sh:70:  $output .= "db_create_table('" . $table . "', " . drupal_var_export($data) . ");\n";
core/scripts/dump-database-d7.sh:66:  $output .= "db_create_table('" . $table . "', " . drupal_var_export($data) . ");\n";

#2 Looks Good.
Thanks!

cilefen’s picture

Status: Reviewed & tested by the community » Needs work
+++ b/core/scripts/dump-database-d6.sh
@@ -67,7 +67,7 @@
-  $output .= "db_create_table('" . $table . "', " . drupal_var_export($data) . ");\n";
+  $output .= "\Drupal::database()->schema()->createTable('" . $table . "', " . drupal_var_export($data) . ");\n";

+++ b/core/scripts/dump-database-d7.sh
@@ -63,7 +63,7 @@
-  $output .= "db_create_table('" . $table . "', " . drupal_var_export($data) . ");\n";
+  $output .= "\Drupal::database()->schema()->createTable('" . $table . "', " . drupal_var_export($data) . ");\n";

You cannot change these files because they are executed in older Drupal versions.

xjm’s picture

Issue tags: +DrupalCampNJ2017
juanjesustrigo’s picture

Assigned: Unassigned » juanjesustrigo

I'll work on this

juanjesustrigo’s picture

Status: Needs work » Needs review
FileSize
1.14 KB
428 bytes

I have made the changes explained in #4

daffie’s picture

Status: Needs review » Reviewed & tested by the community

Looks good

nesta_’s picture

Issue tags: +DevDaysSeville

add Tag

juanjesustrigo’s picture

Assigned: juanjesustrigo » Unassigned

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 7: drupal-replacing-calls-to-db_create_table-2848822-7.patch, failed testing.

jeetendrakumar’s picture

Status: Needs work » Needs review
FileSize
5.54 KB
daffie’s picture

Status: Needs review » Reviewed & tested by the community

@jeetendrakumar: The drupal core committers do not want the same changes made to test classes. See #2848479: Replace all calls to db_drop_table, which is deprecated..

Back to RTBC for the patch from comment #7.

cilefen’s picture

Status: Reviewed & tested by the community » Needs work

I cannot commit #7 because there is a coding standard violation.

122 | ERROR | [x] Expected one space after the comma, 0 found
     |       |     (Drupal.WhiteSpace.Comma.NoSpace)
jeetendrakumar’s picture

Assigned: Unassigned » jeetendrakumar
jeetendrakumar’s picture

Status: Needs work » Needs review
FileSize
429 bytes

As per comment #14, Solved coding standard violation.

jeetendrakumar’s picture

Assigned: jeetendrakumar » Unassigned
ajmantis’s picture

Status: Needs review » Reviewed & tested by the community

Looks good

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 16: drupal-replacing-calls-to-db_create_table-2848822-16.patch, failed testing.

juanjesustrigo’s picture

Status: Needs work » Needs review
juanjesustrigo’s picture

Status: Needs review » Reviewed & tested by the community

I Put the issue in RTBC after retest pass.

catch’s picture

Status: Reviewed & tested by the community » Fixed

I think a follow-up for test coverage covering all of schema.inc is fine - we do want to remove the deprecated calls in tests, but we also want to add explicit test coverage for deprecated code too: https://www.drupal.org/core/deprecation

Committed/pushed to 8.4.x, thanks!

  • catch committed 3d786b4 on 8.4.x
    Issue #2848822 by jeetendrakumar, juanjesustrigo, vidhatanand: Replace...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

Anonymous’s picture

Hi All ,
I am getting this exception when using new syntax in my module 'PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'unsigned NOT NULL COMMENT ' AMOUNT', rate unsigned NOT NULL COMMENT 'R' at line 3: CREATE TABLE {sampletest} ( id INT unsigned NOT NULL COMMENT 'My unique identifier', amount unsigned NOT NULL COMMENT 'AMOUNT', rate unsigned NOT NULL COMMENT ' RATE', time unsigned NOT NULL COMMENT ' TIME', PRIMARY KEY (id) ) ENGINE = InnoDB DEFAULT CHARACTER SET utf8 COMMENT ' table'; Array ( ) in db_create_table()'

cilefen’s picture

This issue affects an unreleased version of Drupal. Open a new support issue and post your code.