Explorar o código

Atualizar 'src/DDLWrapper/Db/Table.php'

ahwelp %!s(int64=7) %!d(string=hai) anos
pai
achega
4a8316e390
Modificáronse 1 ficheiros con 17 adicións e 0 borrados
  1. 17 0
      src/DDLWrapper/Db/Table.php

+ 17 - 0
src/DDLWrapper/Db/Table.php

@@ -577,6 +577,23 @@ class Table
         return $this;
     }
 
+     /**
+      * Add deleted_at column to the table.
+      *
+      * @param string $deletedAtColumnName
+      *
+      * @return Table
+     */
+    public function addSoftDelete($deletedAtColumnName = 'deleted_at'){
+    	$deletedAtColumnName = is_null($deletedAtColumnName) ? 'deleted_at' : $deletedAtColumnName;
+        $this->addColumn($createdAtColumnName, 'timestamp', array(
+            'default' => 'null',
+            'null'    => true,
+        ));
+        return $this;
+    }  
+  
+  
     /**
      * Insert data into the table.
      *